The best way to control Claude Code, Codex and more from any computer or phone

main
tsx 38 lines 1.34 KB
Raw
1 import { createContext, use, type ComponentProps } from "react";
2 import { View } from "react-native";
3
4 import { AppText as Text } from "../../../components/ui/AppText";
5 import { ListSection } from "../../../components/ui/ListSection";
6
7 /**
8 * Set while the Settings list is a split view's sidebar, naming the page open beside it. Like the
9 * system Settings app, the sidebar lists plain rows and highlights that page instead of cards.
10 */
11 export const SettingsSidebarContext = createContext<{ readonly selected: string | null } | null>(
12 null,
13 );
14
15 export function SettingsSection(props: ComponentProps<typeof ListSection>) {
16 if (!use(SettingsSidebarContext)) return <ListSection {...props} />;
17 return (
18 <View className="gap-1">
19 {props.title ? (
20 <View className="flex-row items-center justify-between gap-3 px-2">
21 <View className="min-w-0 flex-1 flex-row items-center gap-2">
22 {props.titleIcon}
23 <Text textRole="footnote" className="shrink font-t3-medium text-foreground-muted">
24 {props.title}
25 </Text>
26 </View>
27 {props.trailing}
28 </View>
29 ) : null}
30 <View>{props.children}</View>
31 {props.footer ? (
32 <Text textRole="footnote" className="px-2 text-foreground-muted">
33 {props.footer}
34 </Text>
35 ) : null}
36 </View>
37 );
38 }