fork
Configure Feed
Select the types of activity you want to include in your feed.
Live video on the AT Protocol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1import { Button, Text, XStack, YStack, YStackProps } from "tamagui";
2
3export default function ButtonSelector({
4 text,
5 values,
6 selectedValue,
7 setSelectedValue,
8 ...props
9}: {
10 text?: string;
11 values: { label: string; value: string }[];
12 selectedValue: string;
13 setSelectedValue: (value: any) => void;
14} & YStackProps) {
15 return (
16 <YStack ai="flex-start" gap="$2" pt="$2" {...props}>
17 {text && (
18 <Text fontSize="$base" fontWeight="semibold">
19 {text}
20 </Text>
21 )}
22 <XStack
23 ai="center"
24 jc="space-around"
25 gap="$1"
26 w="100%"
27 bg="$background"
28 borderRadius="$xl"
29 >
30 {values.map(({ label, value }) => (
31 <Button
32 key={value}
33 onPress={() => setSelectedValue(value)}
34 f={1}
35 height="$2"
36 variant={selectedValue === value ? "outlined" : undefined}
37 >
38 <Text
39 color={
40 selectedValue === value
41 ? "$color.foreground"
42 : "$color.mutedForeground"
43 }
44 >
45 {label}
46 </Text>
47 </Button>
48 ))}
49 </XStack>
50 </YStack>
51 );
52}