Skip to content

Commit f27a865

Browse files
refactor(mobile): style appearance code preview with semantic classes
The CodeAppearancePreview read the JS palette for the line-number and keyword colors of two ordinary Text nodes. Render them with the text-icon-subtle and text-md-link semantic classes (same tokens, and the nested-Text conditional class pattern already used by thread search matches), keep only the dynamic font metrics in style, and drop AppearancePreviews.tsx from the allowUniwindTheme override so future JS palette reads in that file are linted. The allowlist now matches the actual useUniwindTheme importers 1:1. Model: callstack/Apex via pi
1 parent ea3916c commit f27a865

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
resolveMarkdownFontSizes,
66
resolveMobileCodeSurface,
77
} from "../../../../lib/appearancePreferences";
8-
import { useUniwindTheme } from "../../../../lib/useUniwindTheme";
98
import { getMobileTerminalTheme } from "../../../terminal/terminalTheme";
109
import { useAppearancePreferences } from "../AppearancePreferencesProvider";
1110

@@ -138,16 +137,12 @@ export function CodeAppearancePreview(props: {
138137
readonly wordBreak: boolean;
139138
}) {
140139
const surface = resolveMobileCodeSurface(props.fontSize);
141-
const theme = useUniwindTheme();
142-
const lineNumberColor = theme["--color-icon-subtle"];
143-
const keywordColor = theme["--color-md-link"];
144140

145141
const lineNumber = (line: CodePreviewLine, index: number) => (
146142
<Text
147-
className="text-right"
143+
className="text-right text-icon-subtle"
148144
key={line.id}
149145
style={{
150-
color: lineNumberColor,
151146
fontFamily: CODE_FONT_FAMILY,
152147
fontSize: surface.lineNumberFontSize,
153148
lineHeight: surface.rowHeight,
@@ -172,8 +167,8 @@ export function CodeAppearancePreview(props: {
172167
{line.tokens.map((token) => (
173168
<Text
174169
key={token.text}
170+
className={token.keyword ? "text-md-link" : undefined}
175171
style={{
176-
color: token.keyword ? keywordColor : undefined,
177172
fontFamily: CODE_FONT_FAMILY,
178173
fontSize: surface.fontSize,
179174
lineHeight: surface.rowHeight,

‎vite.config.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ export default defineConfig({
208208
"apps/mobile/src/features/review/ReviewSheet.tsx",
209209
"apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
210210
"apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
211-
"apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx",
212211
"apps/mobile/src/features/threads/GitActionProgressOverlay.tsx",
213212
"apps/mobile/src/features/threads/NewTaskDraftScreen.tsx",
214213
"apps/mobile/src/features/threads/ThreadComposer.tsx",

0 commit comments

Comments
 (0)