diff --git a/src/features/gifPicker/components/GifCategoryPills.tsx b/src/features/gifPicker/components/GifCategoryPills.tsx new file mode 100644 index 0000000000..ffbc804a5a --- /dev/null +++ b/src/features/gifPicker/components/GifCategoryPills.tsx @@ -0,0 +1,65 @@ +import {ScrollView, View} from 'react-native' +import {i18n, type MessageDescriptor} from '@lingui/core' +import {msg} from '@lingui/core/macro' +import {useLingui} from '@lingui/react' + +import {atoms as a} from '#/alf' +import {Button, ButtonText} from '#/components/Button' + +export type GifCategory = { + id: string + emoji: string + label: MessageDescriptor + searchterm: string | null // null = trending (uses featured endpoint) +} + +export const GIF_CATEGORIES: readonly GifCategory[] = [ + {id: 'trending', emoji: '🔥', label: msg`Trending`, searchterm: null}, + {id: 'love', emoji: '❤️', label: msg`Love`, searchterm: 'love'}, + {id: 'happy', emoji: '😄', label: msg`Happy`, searchterm: 'happy'}, + {id: 'sad', emoji: '😢', label: msg`Sad`, searchterm: 'cry'}, + {id: 'party', emoji: '🎉', label: msg`Party`, searchterm: 'congratulations'}, + {id: 'yes', emoji: '👍', label: msg`Yes`, searchterm: 'yes'}, + {id: 'lol', emoji: '😂', label: msg`LOL`, searchterm: 'lol'}, + {id: 'excited', emoji: '🤩', label: msg`Excited`, searchterm: 'excited'}, +] as const + +export function GifCategoryPills({ + activeId, + onSelect, +}: { + activeId: string + onSelect: (category: GifCategory) => void +}) { + // useLingui() is called to re-render when the locale changes, even though we + // translate via i18n._() below to satisfy the lingui-msg-rule lint constraint. + useLingui() + + return ( + + + {GIF_CATEGORIES.map(category => { + const isActive = category.id === activeId + const label = i18n._(category.label) + return ( + + ) + })} + + + ) +}