Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

at build-1 56 lines 1.4 kB view raw
1import { Button, Text, XStack, YStack, YStackProps } from "tamagui"; 2 3export default function ButtonSelector({ 4 text, 5 values, 6 selectedValue, 7 setSelectedValue, 8 disabledValues, 9 ...props 10}: { 11 text?: string; 12 values: { label: string; value: string }[]; 13 selectedValue: string; 14 setSelectedValue: (value: any) => void; 15 disabledValues?: string[]; 16} & YStackProps) { 17 return ( 18 <YStack ai="flex-start" gap="$2" pt="$2" {...props}> 19 {text && ( 20 <Text fontSize="$base" fontWeight="semibold"> 21 {text} 22 </Text> 23 )} 24 <XStack 25 ai="center" 26 jc="space-around" 27 gap="$1" 28 w="100%" 29 bg="$background" 30 borderRadius="$xl" 31 > 32 {values.map(({ label, value }) => ( 33 <Button 34 key={value} 35 onPress={() => setSelectedValue(value)} 36 f={1} 37 height="$2" 38 disabled={disabledValues?.includes(value)} 39 opacity={disabledValues?.includes(value) ? 0.5 : 1} 40 variant={selectedValue === value ? "outlined" : undefined} 41 > 42 <Text 43 color={ 44 selectedValue === value 45 ? "$color.foreground" 46 : "$color.mutedForeground" 47 } 48 > 49 {label} 50 </Text> 51 </Button> 52 ))} 53 </XStack> 54 </YStack> 55 ); 56}