Skip to content

Commit 4255db7

Browse files
fix(mobile): preserve terminal fonts in appearance preview
- Reapply terminal font styles to nested preview text spans - Keep syntax colors, backgrounds, and decorations intact
1 parent cacccc0 commit 4255db7

1 file changed

Lines changed: 41 additions & 25 deletions

File tree

‎apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx‎

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { Platform, ScrollView, View, useColorScheme } from "react-native";
1+
import {
2+
Platform,
3+
ScrollView,
4+
type StyleProp,
5+
type TextStyle,
6+
View,
7+
useColorScheme,
8+
} from "react-native";
29

310
import { AppText as Text } from "../../../../components/AppText";
411
import {
@@ -54,39 +61,48 @@ export function TerminalAppearancePreview(props: { readonly fontSize: number })
5461
fontSize: props.fontSize,
5562
lineHeight,
5663
} as const;
64+
// AppText stamps the sans font on every node, so nested spans must
65+
// re-apply the terminal font instead of relying on inheritance, exactly
66+
// like the code preview's tokens below.
67+
const span = (color: string, extra?: TextStyle): StyleProp<TextStyle> => [
68+
lineStyle,
69+
{ color, ...extra },
70+
];
5771

5872
return (
5973
<View className="p-4">
60-
<Text style={[lineStyle, { color: theme.foreground }]}>
61-
<Text style={{ color: theme.palette[2] }}>→ </Text>
62-
<Text style={{ color: theme.palette[6] }}>t3code </Text>
63-
<Text style={{ color: theme.palette[4] }}>git:(</Text>
64-
<Text style={{ color: theme.palette[1] }}>main</Text>
65-
<Text style={{ color: theme.palette[4] }}>)</Text>
66-
<Text style={{ color: theme.palette[3] }}> ✗</Text>
67-
<Text> vpr dev</Text>
74+
<Text style={span(theme.foreground)}>
75+
<Text style={span(theme.palette[2])}>→ </Text>
76+
<Text style={span(theme.palette[6])}>t3code </Text>
77+
<Text style={span(theme.palette[4])}>git:(</Text>
78+
<Text style={span(theme.palette[1])}>main</Text>
79+
<Text style={span(theme.palette[4])}>)</Text>
80+
<Text style={span(theme.palette[3])}> ✗</Text>
81+
<Text style={span(theme.foreground)}> vpr dev</Text>
6882
</Text>
69-
<Text style={[lineStyle, { color: theme.foreground }]}>
70-
<Text style={{ color: theme.palette[2] }}>VITE v7.1.1</Text>
71-
<Text style={{ color: theme.mutedForeground }}> ready in</Text>
72-
<Text> 1.24s</Text>
83+
<Text style={span(theme.foreground)}>
84+
<Text style={span(theme.palette[2])}>VITE v7.1.1</Text>
85+
<Text style={span(theme.mutedForeground)}> ready in</Text>
86+
<Text style={span(theme.foreground)}> 1.24s</Text>
7387
</Text>
74-
<Text style={[lineStyle, { color: theme.foreground }]}>
75-
<Text style={{ color: theme.palette[2] }}>→ </Text>
76-
<Text style={{ color: theme.mutedForeground }}>Local: </Text>
77-
<Text style={{ color: theme.palette[6], textDecorationLine: "underline" }}>
88+
<Text style={span(theme.foreground)}>
89+
<Text style={span(theme.palette[2])}>→ </Text>
90+
<Text style={span(theme.mutedForeground)}>Local: </Text>
91+
<Text style={span(theme.palette[6], { textDecorationLine: "underline" })}>
7892
http://127.0.0.1:5173/
7993
</Text>
8094
</Text>
81-
<Text style={[lineStyle, { color: theme.foreground }]}>
82-
<Text style={{ color: theme.palette[2] }}>✓ 85 passed</Text>
83-
<Text style={{ color: theme.palette[3] }}> △ 2 warnings</Text>
84-
<Text style={{ color: theme.palette[1] }}> ✗ 0 failed</Text>
95+
<Text style={span(theme.foreground)}>
96+
<Text style={span(theme.palette[2])}>✓ 85 passed</Text>
97+
<Text style={span(theme.palette[3])}> △ 2 warnings</Text>
98+
<Text style={span(theme.palette[1])}> ✗ 0 failed</Text>
8599
</Text>
86-
<Text style={[lineStyle, { color: theme.foreground }]}>
87-
<Text style={{ backgroundColor: theme.palette[2], color: theme.background }}> READY </Text>
88-
<Text style={{ color: theme.mutedForeground }}> watching for changes</Text>{" "}
89-
<Text style={{ color: theme.cursorForeground }}>▏</Text>
100+
<Text style={span(theme.foreground)}>
101+
<Text style={span(theme.background, { backgroundColor: theme.palette[2] })}>
102+
{" READY "}
103+
</Text>
104+
<Text style={span(theme.mutedForeground)}> watching for changes</Text>{" "}
105+
<Text style={span(theme.cursorForeground)}>▏</Text>
90106
</Text>
91107
</View>
92108
);

0 commit comments

Comments
 (0)