@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 61 lines 1.96 KB
Raw
1 import { useGT } from "gt-react-native";
2 import {
3 CODE_FONT_SIZE_STEP,
4 MAX_CODE_FONT_SIZE,
5 MIN_CODE_FONT_SIZE,
6 } from "../../../../lib/appearancePreferences";
7 import { SettingsSection } from "../../components/SettingsSection";
8 import { SettingsSwitchRow } from "../../components/SettingsSwitchRow";
9 import { useAppearancePreferences } from "../AppearancePreferencesProvider";
10 import {
11 AppearancePreviewSeparator,
12 CodeAppearancePreview,
13 } from "../components/AppearancePreviews";
14 import { FontSizeSliderRow } from "../components/FontSizeSliderRow";
15
16 export function CodeAppearanceSection() {
17 const gt = useGT();
18 const { isReady, appearance, setCodeFontSize, setCodeWordBreak } = useAppearancePreferences();
19 const custom = appearance.isCodeFontSizeCustom;
20
21 const handleToggleCustom = (enabled: boolean) => {
22 setCodeFontSize(enabled ? appearance.codeFontSize : null);
23 };
24
25 return (
26 <SettingsSection title={gt("Code & Diffs")}>
27 <CodeAppearancePreview
28 fontSize={appearance.codeFontSize}
29 wordBreak={appearance.codeWordBreak}
30 />
31 <AppearancePreviewSeparator />
32 <SettingsSwitchRow
33 disabled={!isReady}
34 icon="chevron.left.forwardslash.chevron.right"
35 label={gt("Custom font size")}
36 onValueChange={handleToggleCustom}
37 value={custom}
38 />
39 {custom ? (
40 <FontSizeSliderRow
41 disabled={!isReady}
42 icon="textformat.size"
43 label={gt("Font size")}
44 max={MAX_CODE_FONT_SIZE}
45 min={MIN_CODE_FONT_SIZE}
46 onChange={setCodeFontSize}
47 step={CODE_FONT_SIZE_STEP}
48 value={appearance.codeFontSize}
49 valueLabel={gt("{size} pt", { size: appearance.codeFontSize })}
50 />
51 ) : null}
52 <SettingsSwitchRow
53 disabled={!isReady}
54 icon="text.word.spacing"
55 label={gt("Word break")}
56 onValueChange={setCodeWordBreak}
57 value={appearance.codeWordBreak}
58 />
59 </SettingsSection>
60 );
61 }