Skip to content

Commit 43b53b6

Browse files
committed
fix: Primer token compliance — nuke legacy CSS, fix focus/motion/a11y
- Remove entire legacy custom property system from index.css (--text, --bg, --accent, etc.) - Remove raw heading styles that bypassed Primer typography tokens - Fix :focus → :focus-visible with Primer outline tokens (PeriodSelector, ReportTable) - Replace raw box-shadow focus rings with var(--focus-outline) - Replace raw transition durations with var(--base-duration-*) and var(--base-easing-*) - Import @primer/primitives motion tokens CSS - Fix raw font-weight: 600 → var(--base-text-weight-semibold) in Charts.module.css - Fix raw gap: 4px and padding: 2px 6px → var(--base-size-*) tokens - Fix NavList.Item defaultOpen warning (only pass when SubNav exists) - Add prefers-reduced-motion: reduce for table row/filter transitions - Add prefers-reduced-motion already existed for FileDropzone
1 parent fd0e0d3 commit 43b53b6

8 files changed

Lines changed: 31 additions & 95 deletions

File tree

src/components/CsvManager.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
.rowActions {
3333
display: inline-flex;
34-
gap: 4px;
34+
gap: var(--base-size-4, 4px);
3535
align-items: center;
3636
}
3737

@@ -81,7 +81,7 @@
8181
}
8282

8383
.zipInfoDesc code {
84-
padding: 2px 6px;
84+
padding: var(--base-size-2, 2px) var(--base-size-6, 6px);
8585
background: var(--bgColor-neutral-muted, #818b981f);
8686
border-radius: var(--borderRadius-small, 4px);
8787
font-size: var(--text-body-size-small, 12px);

src/components/FileDropzone.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
text-align: center;
66
cursor: pointer;
77
background-color: var(--bgColor-default, #ffffff);
8-
transition: border-color 150ms ease, background-color 150ms ease;
8+
transition: border-color var(--base-duration-200, 200ms) var(--base-easing-ease, ease),
9+
background-color var(--base-duration-200, 200ms) var(--base-easing-ease, ease);
910
}
1011

1112
.dropzone:hover,

src/components/InsightsSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export function InsightsSidebar({
141141
key={id}
142142
href={buildPathForPage(id)}
143143
aria-current={activePage === id && !activeProductFilter ? 'page' : undefined}
144-
defaultOpen={isUsagePage && activePage === PAGE_TYPES.USAGE}
144+
{...(showSubNav ? { defaultOpen: activePage === PAGE_TYPES.USAGE } : {})}
145145
onClick={(event) => {
146146
event.preventDefault();
147147
setActivePage(id);

src/components/PeriodSelector.module.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939
line-height: 1.5;
4040
}
4141

42-
.dateInput:focus {
42+
.dateInput:focus-visible {
4343
border-color: var(--borderColor-accent-emphasis, #0969da);
44-
outline: none;
45-
box-shadow: inset 0 0 0 1px var(--borderColor-accent-emphasis, #0969da);
44+
outline: var(--focus-outline, 2px solid #0969da);
45+
outline-offset: -1px;
46+
box-shadow: none;
4647
}
4748

4849
.customActions {

src/components/ReportTable.module.css

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159

160160
/* Rows */
161161
.tr {
162-
transition: background-color 0.1s;
162+
transition: background-color var(--base-duration-100, 100ms) var(--base-easing-ease, ease);
163163
}
164164

165165
.tr:hover {
@@ -216,12 +216,14 @@
216216
border: var(--borderWidth-thin, 1px) solid var(--borderColor-default, #d1d9e0);
217217
border-radius: var(--borderRadius-medium, 6px);
218218
outline: none;
219-
transition: border-color 0.15s;
219+
transition: border-color var(--base-duration-100, 100ms) var(--base-easing-ease, ease);
220220
}
221221

222-
.filterInput:focus {
222+
.filterInput:focus-visible {
223223
border-color: var(--focus-outlineColor, #0969da);
224-
box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
224+
outline: var(--focus-outline, 2px solid #0969da);
225+
outline-offset: -1px;
226+
box-shadow: none;
225227
}
226228

227229
.filterInput::placeholder {
@@ -326,3 +328,10 @@
326328
outline: none;
327329
cursor: pointer;
328330
}
331+
332+
@media (prefers-reduced-motion: reduce) {
333+
.tr,
334+
.filterInput {
335+
transition: none;
336+
}
337+
}

src/components/charts/Charts.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.chartTitle {
1212
margin: 0;
1313
font-size: var(--text-body-size-medium, 14px);
14-
font-weight: 600;
14+
font-weight: var(--base-text-weight-semibold, 600);
1515
color: var(--fgColor-default, #1f2328);
1616
}
1717

src/index.css

Lines changed: 7 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,4 @@
1-
:root {
2-
--text: #6b6375;
3-
--text-h: #08060d;
4-
--bg: #fff;
5-
--border: #e5e4e7;
6-
--code-bg: #f4f3ec;
7-
--accent: #aa3bff;
8-
--accent-bg: rgba(170, 59, 255, 0.1);
9-
--accent-border: rgba(170, 59, 255, 0.5);
10-
--social-bg: rgba(244, 243, 236, 0.5);
11-
--shadow:
12-
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
13-
14-
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
15-
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
16-
--mono: ui-monospace, Consolas, monospace;
17-
18-
font: 18px/145% var(--sans);
19-
letter-spacing: 0.18px;
20-
color-scheme: light dark;
21-
color: var(--text);
22-
background: var(--bg);
23-
font-synthesis: none;
24-
text-rendering: optimizeLegibility;
25-
-webkit-font-smoothing: antialiased;
26-
-moz-osx-font-smoothing: grayscale;
27-
28-
@media (max-width: 1024px) {
29-
font-size: 16px;
30-
}
31-
}
32-
33-
@media (prefers-color-scheme: dark) {
34-
:root {
35-
--text: #9ca3af;
36-
--text-h: #f3f4f6;
37-
--bg: #16171d;
38-
--border: #2e303a;
39-
--code-bg: #1f2028;
40-
--accent: #c084fc;
41-
--accent-bg: rgba(192, 132, 252, 0.15);
42-
--accent-border: rgba(192, 132, 252, 0.5);
43-
--social-bg: rgba(47, 48, 58, 0.5);
44-
--shadow:
45-
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
46-
}
47-
48-
#social .button-icon {
49-
filter: invert(1) brightness(2);
50-
}
51-
}
1+
/* Layout & resets — all colors/typography come from Primer tokens */
522

533
#root {
544
max-width: 100%;
@@ -63,46 +13,20 @@ body {
6313
margin: 0;
6414
}
6515

66-
h1,
67-
h2 {
68-
font-family: var(--heading);
69-
font-weight: 500;
70-
color: var(--text-h);
71-
}
72-
73-
h1 {
74-
font-size: 56px;
75-
letter-spacing: -1.68px;
76-
margin: 32px 0;
77-
@media (max-width: 1024px) {
78-
font-size: 36px;
79-
margin: 20px 0;
80-
}
81-
}
82-
h2 {
83-
font-size: 24px;
84-
line-height: 118%;
85-
letter-spacing: -0.24px;
86-
margin: 0 0 8px;
87-
@media (max-width: 1024px) {
88-
font-size: 20px;
89-
}
90-
}
9116
p {
9217
margin: 0;
9318
}
9419

9520
code,
9621
.counter {
97-
font-family: var(--mono);
22+
font-family: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace);
9823
display: inline-flex;
99-
border-radius: 4px;
100-
color: var(--text-h);
24+
border-radius: var(--borderRadius-small, 3px);
25+
color: var(--fgColor-default, #1f2328);
10126
}
10227

10328
code {
104-
font-size: 15px;
105-
line-height: 135%;
106-
padding: 4px 8px;
107-
background: var(--code-bg);
29+
font: var(--text-codeInline-shorthand, 400 0.9285em ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace);
30+
padding: var(--base-size-4, 4px) var(--base-size-8, 8px);
31+
background: var(--bgColor-neutral-muted, #818b981f);
10832
}

src/main.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { StrictMode, useState, useMemo } from 'react';
22
import { createRoot } from 'react-dom/client';
33
import '@primer/primitives/dist/css/functional/themes/light.css';
44
import '@primer/primitives/dist/css/functional/themes/dark.css';
5+
import '@primer/primitives/dist/css/base/motion/motion.css';
56
import { ThemeProvider, BaseStyles } from '@primer/react';
67
import App from './App';
78
import { ThemeContext } from './context/theme-context';

0 commit comments

Comments
 (0)