@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
tsx 67 lines 2.32 KB
Raw
1 import type { ComponentProps, ReactNode } from "react";
2 import { Platform, Pressable, View } from "react-native";
3
4 import { useAppearancePreferences } from "../../features/settings/appearance/AppearancePreferencesProvider";
5 import { cn } from "../../lib/cn";
6 import { AppText } from "./AppText";
7 import { SymbolView } from "./AppSymbol";
8 import { useAndroidControlSizing } from "./useAndroidControlSizing";
9
10 export function NavigationRow({
11 title,
12 titleClassName,
13 subtitle,
14 subtitleNumberOfLines,
15 subtitleEllipsizeMode,
16 leading,
17 trailing,
18 className,
19 ...props
20 }: Omit<ComponentProps<typeof Pressable>, "children"> & {
21 readonly title: string;
22 readonly titleClassName?: string;
23 readonly subtitle?: string | null;
24 readonly subtitleNumberOfLines?: ComponentProps<typeof AppText>["numberOfLines"];
25 readonly subtitleEllipsizeMode?: ComponentProps<typeof AppText>["ellipsizeMode"];
26 readonly leading?: ReactNode;
27 readonly trailing?: ReactNode;
28 }) {
29 const { themeVariables } = useAppearancePreferences();
30 const { smallIconSize } = useAndroidControlSizing();
31 return (
32 <Pressable
33 accessibilityRole="button"
34 accessibilityLabel={[title, subtitle].filter(Boolean).join(", ")}
35 android_ripple={{ color: themeVariables["--color-subtle-strong"] }}
36 unstable_pressDelay={Platform.OS === "android" ? 50 : undefined}
37 {...props}
38 className={cn(
39 "flex-row items-center gap-4 overflow-hidden bg-card px-4 py-3",
40 subtitle ? "min-h-18" : "min-h-14",
41 props.disabled && "opacity-45",
42 className,
43 )}
44 >
45 {leading ? <View className="size-6 items-center justify-center">{leading}</View> : null}
46 <View className="min-w-0 flex-1 gap-1">
47 <AppText className={cn("text-base text-foreground", titleClassName)} numberOfLines={2}>
48 {title}
49 </AppText>
50 {subtitle ? (
51 <AppText
52 className="text-sm text-foreground-muted"
53 ellipsizeMode={subtitleEllipsizeMode}
54 numberOfLines={subtitleNumberOfLines ?? 2}
55 >
56 {subtitle}
57 </AppText>
58 ) : null}
59 </View>
60 {trailing !== undefined ? (
61 trailing
62 ) : !props.disabled ? (
63 <SymbolView name="chevron.right" size={smallIconSize} tintColorClassName="accent-chevron" />
64 ) : null}
65 </Pressable>
66 );
67 }