-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(a11y): turn dropdowns into action sheets (#5798)
- Loading branch information
1 parent
a9ad692
commit 276172b
Showing
34 changed files
with
292 additions
and
871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/views/CannedResponsesListView/DepartmentFilter/DepartmentItemFilter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
|
||
import { ILivechatDepartment } from '../../../definitions/ILivechatDepartment'; | ||
import { useTheme } from '../../../theme'; | ||
import Touch from '../../../containers/Touch'; | ||
import { CustomIcon } from '../../../containers/CustomIcon'; | ||
import sharedStyles from '../../Styles'; | ||
|
||
interface IDepartmentItemFilter { | ||
currentDepartment: ILivechatDepartment; | ||
value: ILivechatDepartment; | ||
onPress: (value: ILivechatDepartment) => void; | ||
} | ||
|
||
export const ROW_HEIGHT = 44; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
paddingVertical: 11, | ||
height: ROW_HEIGHT, | ||
paddingHorizontal: 16, | ||
flexDirection: 'row', | ||
alignItems: 'center' | ||
}, | ||
text: { | ||
flex: 1, | ||
fontSize: 16, | ||
...sharedStyles.textRegular | ||
} | ||
}); | ||
|
||
const DepartmentItemFilter = ({ currentDepartment, value, onPress }: IDepartmentItemFilter): JSX.Element => { | ||
const { colors } = useTheme(); | ||
const iconName = currentDepartment?._id === value?._id ? 'check' : null; | ||
|
||
return ( | ||
<Touch onPress={() => onPress(value)} style={{ backgroundColor: colors.surfaceRoom }}> | ||
<View style={styles.container}> | ||
<Text style={[styles.text, { color: colors.fontSecondaryInfo }]}>{value?.name}</Text> | ||
{iconName ? <CustomIcon name={iconName} size={22} color={colors.fontSecondaryInfo} /> : null} | ||
</View> | ||
</Touch> | ||
); | ||
}; | ||
|
||
export default DepartmentItemFilter; |
42 changes: 42 additions & 0 deletions
42
app/views/CannedResponsesListView/DepartmentFilter/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { FlatList, View } from 'react-native'; | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
|
||
import { useTheme } from '../../../theme'; | ||
import * as List from '../../../containers/List'; | ||
import DepartmentItemFilter, { ROW_HEIGHT } from './DepartmentItemFilter'; | ||
import { ILivechatDepartment } from '../../../definitions/ILivechatDepartment'; | ||
|
||
const MAX_ROWS = 5; | ||
|
||
interface IDepartmentFilterProps { | ||
currentDepartment: ILivechatDepartment; | ||
onDepartmentSelected: (value: ILivechatDepartment) => void; | ||
departments: ILivechatDepartment[]; | ||
} | ||
|
||
const DepartmentFilter = ({ currentDepartment, onDepartmentSelected, departments }: IDepartmentFilterProps) => { | ||
const { colors } = useTheme(); | ||
const insets = useSafeAreaInsets(); | ||
|
||
return ( | ||
<View | ||
style={{ | ||
backgroundColor: colors.surfaceRoom, | ||
borderColor: colors.strokeLight, | ||
marginBottom: insets.bottom | ||
}}> | ||
<FlatList | ||
style={{ maxHeight: MAX_ROWS * ROW_HEIGHT }} | ||
data={departments} | ||
keyExtractor={item => item._id} | ||
renderItem={({ item }) => ( | ||
<DepartmentItemFilter onPress={onDepartmentSelected} currentDepartment={currentDepartment} value={item} /> | ||
)} | ||
ItemSeparatorComponent={List.Separator} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
export default DepartmentFilter; |
46 changes: 0 additions & 46 deletions
46
app/views/CannedResponsesListView/Dropdown/DropdownItem.tsx
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
app/views/CannedResponsesListView/Dropdown/DropdownItemFilter.tsx
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
app/views/CannedResponsesListView/Dropdown/DropdownItemHeader.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.