Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

sidebar-header-actions.tsx

40 lines1.1 KB

1import { SymbolView } from "../../components/AppSymbol";
2import { Pressable, View } from "react-native";
3​
4import { useThemeColor } from "../../lib/useThemeColor";
5​
6export interface SidebarHeaderActionsProps {
7 readonly onOpenSettings: () => void;
8}
9​
10function FallbackHeaderButton(props: {
11 readonly accessibilityLabel: string;
12 readonly icon: "gearshape" | "square.and.pencil";
13 readonly onPress: () => void;
14}) {
15 const iconColor = useThemeColor("--color-foreground");
16​
17 return (
18 <Pressable
19 className="size-11 items-center justify-center rounded-full bg-subtle active:opacity-70"
20 accessibilityLabel={props.accessibilityLabel}
21 accessibilityRole="button"
22 hitSlop={4}
23 onPress={props.onPress}
24 >
25 <SymbolView name={props.icon} size={18} tintColor={iconColor} type="monochrome" />
26 </Pressable>
27 );
29​
30export function SidebarHeaderActions(props: SidebarHeaderActionsProps) {
31 return (
32 <View className="flex-row items-center gap-0.5">
33 <FallbackHeaderButton
34 accessibilityLabel="Open settings"
35 icon="gearshape"
36 onPress={props.onOpenSettings}
37 />
38 </View>
39 );