Migrate UI styles to Zen theme tokens and preserve brand colors

This commit is contained in:
Mike Cao committed 2026-09-07 10:28:16 -07:00
1 parent 0f187dcac1
commit 9ff1ecb6dd
17 files changed
+65 -49

No files matched your search

+1 -1
View File
@@ -71,7 +71,7 @@ export function SideNav(props: any) {
return ( return (
<Column <Column
{...props} {...props}
backgroundColor="surface-base" backgroundColor="surface"
border border
borderRadius borderRadius
padding="2" padding="2"
+1 -1
View File
@@ -13,7 +13,7 @@ export function BoardEntityBadge({
domain?: string; domain?: string;
}) { }) {
return ( return (
<Row padding borderRadius="full" backgroundColor="surface-base" border gap="2"> <Row padding borderRadius="full" backgroundColor="surface" border gap="2">
<Icon> <Icon>
{type === 'pixel' ? <Grid2x2 /> : type === 'link' ? <Link /> : <Favicon domain={domain} />} {type === 'pixel' ? <Grid2x2 /> : type === 'link' ? <Link /> : <Favicon domain={domain} />}
</Icon> </Icon>
@@ -12,7 +12,7 @@
.railDivider { .railDivider {
width: 1px; width: 1px;
height: 100%; height: 100%;
background: var(--zen-gray-300, #d1d5db); background: var(--zen-palette-300, #d1d5db);
justify-self: center; justify-self: center;
} }
@@ -74,7 +74,7 @@
.mobileSelectedPageButton { .mobileSelectedPageButton {
width: 100%; width: 100%;
text-align: left; text-align: left;
border: 1px solid var(--zen-border-default); border: 1px solid var(--zen-border);
background: var(--zen-surface-raised); background: var(--zen-surface-raised);
border-radius: 8px; border-radius: 8px;
padding: 10px 12px; padding: 10px 12px;
@@ -109,7 +109,7 @@
padding: 4px 10px; padding: 4px 10px;
border-radius: 999px; border-radius: 999px;
background: var(--zen-surface-raised); background: var(--zen-surface-raised);
border: 1px solid var(--zen-border-default); border: 1px solid var(--zen-border);
white-space: nowrap; white-space: nowrap;
} }
@@ -175,7 +175,7 @@
.canvas { .canvas {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
border: 1px solid var(--zen-border-default); border: 1px solid var(--zen-border);
border-radius: 8px; border-radius: 8px;
background: var(--zen-surface-sunken); background: var(--zen-surface-sunken);
flex: 0 0 auto; flex: 0 0 auto;
@@ -224,7 +224,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
border: 0; border: 0;
background: var(--zen-surface-base); background: var(--zen-surface);
overflow: hidden; overflow: hidden;
pointer-events: none; pointer-events: none;
} }
@@ -43,7 +43,7 @@
.dropoff { .dropoff {
font-weight: 600; font-weight: 600;
color: var(--zen-text-muted); color: var(--zen-fg-muted);
background: var(--zen-surface-sunken); background: var(--zen-surface-sunken);
padding: 4px 8px; padding: 4px 8px;
border-radius: 5px; border-radius: 5px;
@@ -58,7 +58,7 @@
height: 50px; height: 50px;
font-size: 16px; font-size: 16px;
font-weight: 700; font-weight: 700;
color: var(--zen-surface-base); color: var(--zen-surface);
background: var(--zen-surface-inverted); background: var(--zen-surface-inverted);
z-index: 1; z-index: 1;
margin: 0 auto 20px; margin: 0 auto 20px;
@@ -100,22 +100,22 @@
} }
.node.selected { .node.selected {
color: var(--zen-surface-base); color: var(--zen-surface);
background: var(--zen-surface-inverted); background: var(--zen-surface-inverted);
} }
.node.active { .node.active {
color: var(--zen-primary-foreground); color: var(--zen-primary-fg);
background: var(--zen-primary); background: var(--zen-primary);
} }
.node.selected .count { .node.selected .count {
color: var(--zen-surface-base); color: var(--zen-surface);
background: var(--zen-surface-inverted); background: var(--zen-surface-inverted);
} }
.node.selected.active .count { .node.selected.active .count {
color: var(--zen-primary-foreground); color: var(--zen-primary-fg);
background: var(--zen-primary); background: var(--zen-primary);
} }
@@ -212,7 +212,7 @@
position: absolute; position: absolute;
border-radius: 100%; border-radius: 100%;
border: 3px solid var(--journey-line-color); border: 3px solid var(--journey-line-color);
background: var(--zen-surface-base); background: var(--zen-surface);
width: 14px; width: 14px;
height: 14px; height: 14px;
} }
@@ -1,3 +1,3 @@
.sampleCount { .sampleCount {
color: var(--zen-text-muted); color: var(--zen-fg-muted);
} }
@@ -29,8 +29,8 @@ export function ReplayPlayer({ events }: { events: any[] }) {
const playerRef = useRef<any>(null); const playerRef = useRef<any>(null);
const [playerError, setPlayerError] = useState(false); const [playerError, setPlayerError] = useState(false);
const [availableWidth, setAvailableWidth] = useState(0); const [availableWidth, setAvailableWidth] = useState(0);
const [viewportHeight, setViewportHeight] = useState( const [viewportHeight, setViewportHeight] = useState(() =>
() => (typeof window !== 'undefined' ? window.innerHeight : 0), typeof window !== 'undefined' ? window.innerHeight : 0,
); );
const { isMobile, isPhone } = useMobile(); const { isMobile, isPhone } = useMobile();
const replayEvents = useMemo(() => getReplayPlayerEvents(events), [events]); const replayEvents = useMemo(() => getReplayPlayerEvents(events), [events]);
@@ -42,9 +42,7 @@ export function ReplayPlayer({ events }: { events: any[] }) {
const replayAspectRatio = replayViewport const replayAspectRatio = replayViewport
? replayViewport.height / replayViewport.width ? replayViewport.height / replayViewport.width
: DEFAULT_REPLAY_ASPECT_RATIO; : DEFAULT_REPLAY_ASPECT_RATIO;
const isPortraitReplay = replayViewport const isPortraitReplay = replayViewport ? replayViewport.height > replayViewport.width : false;
? replayViewport.height > replayViewport.width
: false;
const fittedAspectRatio = isPortraitReplay const fittedAspectRatio = isPortraitReplay
? Math.min(Math.max(replayAspectRatio, DEFAULT_REPLAY_ASPECT_RATIO), 2.25) ? Math.min(Math.max(replayAspectRatio, DEFAULT_REPLAY_ASPECT_RATIO), 2.25)
: Math.min(Math.max(replayAspectRatio, DEFAULT_REPLAY_ASPECT_RATIO), 1.5); : Math.min(Math.max(replayAspectRatio, DEFAULT_REPLAY_ASPECT_RATIO), 1.5);
@@ -161,7 +159,10 @@ export function ReplayPlayer({ events }: { events: any[] }) {
return ( return (
<Column alignItems="center" width="100%"> <Column alignItems="center" width="100%">
<div ref={playerWrapperRef} style={{ width: '100%', display: 'flex', justifyContent: 'center' }}> <div
ref={playerWrapperRef}
style={{ width: '100%', display: 'flex', justifyContent: 'center' }}
>
<div <div
style={{ style={{
width: playerWidth, width: playerWidth,
@@ -169,7 +170,7 @@ export function ReplayPlayer({ events }: { events: any[] }) {
height: showUnavailable ? playerHeight : playerOuterHeight, height: showUnavailable ? playerHeight : playerOuterHeight,
overflow: 'hidden', overflow: 'hidden',
borderRadius: '8px', borderRadius: '8px',
border: '1px solid var(--zen-border-default)', border: '1px solid var(--zen-border)',
background: 'var(--zen-surface-sunken)', background: 'var(--zen-surface-sunken)',
}} }}
> >
+23 -8
View File
@@ -1,19 +1,34 @@
:root { :root {
--zen-font-family: var(--font-inter), sans-serif; --zen-font-family: var(--font-inter), sans-serif;
}
/* Preserve the brand accent when Zen applies its light or dark theme tokens. */
:root,
[data-theme="light"],
[data-theme="dark"],
.dark {
--zen-primary: oklch(62.3% 0.214 259.815); --zen-primary: oklch(62.3% 0.214 259.815);
--zen-primary-foreground: oklch(98.5% 0 0); --zen-primary-fg: oklch(98.5% 0 0);
}
/* Zen's rem-based typography and spacing assume the browser's default root size. */
html {
font-size: 100%;
} }
html, html,
body { body {
font-family: var(--zen-font-family), sans-serif; font-family: var(--zen-font-family), sans-serif;
font-size: 14px; color: var(--zen-fg);
color: var(--zen-text-primary);
background-color: var(--zen-surface-raised); background-color: var(--zen-surface-raised);
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
} }
body {
font-size: 0.875rem;
}
html[style*="padding-right"] { html[style*="padding-right"] {
padding-right: 0 !important; padding-right: 0 !important;
} }
@@ -29,11 +44,11 @@ textarea:is(:-webkit-autofill, :autofill):focus,
select:is(:-webkit-autofill, :autofill), select:is(:-webkit-autofill, :autofill),
select:is(:-webkit-autofill, :autofill):hover, select:is(:-webkit-autofill, :autofill):hover,
select:is(:-webkit-autofill, :autofill):focus { select:is(:-webkit-autofill, :autofill):focus {
color: var(--zen-text-primary) !important; color: var(--zen-fg) !important;
caret-color: var(--zen-text-primary); caret-color: var(--zen-fg);
box-shadow: 0 0 0 1000px var(--zen-surface-base) inset !important; box-shadow: 0 0 0 1000px var(--zen-surface) inset !important;
-webkit-box-shadow: 0 0 0 1000px var(--zen-surface-base) inset !important; -webkit-box-shadow: 0 0 0 1000px var(--zen-surface) inset !important;
-webkit-text-fill-color: var(--zen-text-primary) !important; -webkit-text-fill-color: var(--zen-fg) !important;
transition: transition:
background-color 5000s ease-in-out 0s, background-color 5000s ease-in-out 0s,
color 5000s ease-in-out 0s; color 5000s ease-in-out 0s;
+2 -2
View File
@@ -47,12 +47,12 @@
} }
.gray { .gray {
color: var(--zen-text-muted); color: var(--zen-fg-muted);
background: var(--zen-surface-sunken); background: var(--zen-surface-sunken);
} }
.gray .dot { .gray .dot {
background: var(--zen-text-muted); background: var(--zen-fg-muted);
} }
:global([data-theme="dark"]) .good { :global([data-theme="dark"]) .good {
@@ -1,7 +1,7 @@
.root { .root {
--overlay-scrollbar-track: var(--zen-gray-50); --overlay-scrollbar-track: var(--zen-palette-50);
--overlay-scrollbar-thumb: var(--zen-gray-300); --overlay-scrollbar-thumb: var(--zen-palette-300);
--overlay-scrollbar-thumb-hover: var(--zen-gray-400); --overlay-scrollbar-thumb-hover: var(--zen-palette-400);
--overlay-scrollbar-viewport-padding-right: 0px; --overlay-scrollbar-viewport-padding-right: 0px;
--overlay-scrollbar-vertical-margin-right: 2px; --overlay-scrollbar-vertical-margin-right: 2px;
} }
@@ -44,8 +44,8 @@
content: ""; content: "";
} }
[data-theme='dark'] .root { [data-theme="dark"] .root {
--overlay-scrollbar-track: var(--zen-gray-800); --overlay-scrollbar-track: var(--zen-palette-800);
--overlay-scrollbar-thumb: var(--zen-gray-600); --overlay-scrollbar-thumb: var(--zen-palette-600);
--overlay-scrollbar-thumb-hover: var(--zen-gray-500); --overlay-scrollbar-thumb-hover: var(--zen-palette-500);
} }
+1 -1
View File
@@ -54,7 +54,7 @@ export function Panel({
paddingX={{ base: '3', md: '6' }} paddingX={{ base: '3', md: '6' }}
border border
borderRadius borderRadius
backgroundColor="surface-base" backgroundColor="surface"
position="relative" position="relative"
gap gap
{...props} {...props}
+2 -2
View File
@@ -18,7 +18,7 @@ export function SortableLabel({ label, sortKey, defaultDirection = 'asc' }: Sort
const isActive = query.orderBy === sortKey; const isActive = query.orderBy === sortKey;
const isDescending = query.sortDescending === 'true'; const isDescending = query.sortDescending === 'true';
const direction = isActive ? (isDescending ? 'desc' : 'asc') : undefined; const direction = isActive ? (isDescending ? 'desc' : 'asc') : undefined;
const activeColor = 'var(--zen-text-primary)'; const activeColor = 'var(--zen-fg)';
const getNextDirection = (): SortDirection => { const getNextDirection = (): SortDirection => {
if (!isActive) { if (!isActive) {
@@ -55,7 +55,7 @@ export function SortableLabel({ label, sortKey, defaultDirection = 'asc' }: Sort
flexDirection: 'column', flexDirection: 'column',
gap: 0, gap: 0,
lineHeight: 0, lineHeight: 0,
color: 'var(--zen-text-muted)', color: 'var(--zen-fg-muted)',
opacity: 0.8, opacity: 0.8,
}} }}
> >
+1 -1
View File
@@ -12,7 +12,7 @@ const STYLES = {
background: `var(--zen-status-error-bg)`, background: `var(--zen-status-error-bg)`,
}, },
neutral: { neutral: {
color: `var(--zen-text-muted)`, color: `var(--zen-fg-muted)`,
background: `var(--zen-surface-raised)`, background: `var(--zen-surface-raised)`,
}, },
}; };
+1 -1
View File
@@ -51,7 +51,7 @@ export const MetricCard = ({
paddingX="6" paddingX="6"
paddingY="4" paddingY="4"
borderRadius borderRadius
backgroundColor="surface-base" backgroundColor="surface"
border border
gap="4" gap="4"
> >
@@ -3,9 +3,9 @@
} }
.card:hover { .card:hover {
box-shadow: 0 0 0 1px var(--zen-text-primary); box-shadow: 0 0 0 1px var(--zen-fg);
} }
.card.selected { .card.selected {
box-shadow: 0 0 0 1px var(--zen-text-primary); box-shadow: 0 0 0 1px var(--zen-fg);
} }
+1 -1
View File
@@ -61,7 +61,7 @@ export const PerformanceCard = ({
paddingX="6" paddingX="6"
paddingY="4" paddingY="4"
borderRadius borderRadius
backgroundColor="surface-base" backgroundColor="surface"
border border
gap="4" gap="4"
onClick={onClick} onClick={onClick}
@@ -55,7 +55,7 @@ function InsightCard({ label, value, hint }: { label: string; value: string; hin
paddingX="6" paddingX="6"
paddingY="4" paddingY="4"
borderRadius borderRadius
backgroundColor="surface-base" backgroundColor="surface"
border border
gap="2" gap="2"
height="100%" height="100%"
+1 -1
View File
@@ -5,7 +5,7 @@ import { useConfig, useMessages, useMobile } from '@/components/hooks';
import { ExternalLink } from '@/components/icons'; import { ExternalLink } from '@/components/icons';
const desktopGridTemplateColumns = 'minmax(180px, 1fr) minmax(0, 2fr) auto'; const desktopGridTemplateColumns = 'minmax(180px, 1fr) minmax(0, 2fr) auto';
const rowBorder = '1px solid var(--zen-border-default)'; const rowBorder = '1px solid var(--zen-border)';
export interface ShareRow { export interface ShareRow {
id: string; id: string;