Skip to content

Commit eeb7a9f

Browse files
Rename legacy gray scale to neutral (#916)
* add base neutral scale * adding storybook test case * renaming base.color.gray to base.color.neutral * github-actions[bot] Regenerated snapshots --------- Co-authored-by: langermank <langermank@users.noreply.github.com>
1 parent 9b58c71 commit eeb7a9f

25 files changed

+513
-219
lines changed

.changeset/unlucky-moles-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/primitives': minor
3+
---
4+
5+
Rename base.color.gray to base.color.neutral, minor because base colors should not be exported

blob-report/report.zip

-8.89 KB
Binary file not shown.
Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
import React from 'react'
2+
import {DataTable, Table} from '@primer/react/drafts'
3+
import './BorderTesting.css'
4+
import {
5+
ThreeBarsIcon,
6+
MarkGithubIcon,
7+
ArrowSwitchIcon,
8+
GearIcon,
9+
CodeIcon,
10+
CreditCardIcon,
11+
MailIcon,
12+
ShieldLockIcon,
13+
BroadcastIcon,
14+
KeyIcon,
15+
OrganizationIcon,
16+
GlobeIcon,
17+
ReportIcon,
18+
RepoIcon,
19+
CodespacesIcon,
20+
PackageIcon,
21+
CopilotIcon,
22+
BrowserIcon,
23+
ReplyIcon,
24+
AppsIcon,
25+
ClockIcon,
26+
LogIcon,
27+
EyeIcon,
28+
FileCodeIcon,
29+
PeopleIcon,
30+
SearchIcon,
31+
} from '@primer/octicons-react'
32+
import {PageLayout, Button, TextInput, SegmentedControl, NavList, Box, Text, IconButton, Octicon} from '@primer/react'
33+
34+
export default {
35+
title: 'Testing/Borders',
36+
parameters: {
37+
controls: {hideNoControlsWarning: true},
38+
options: {
39+
showPanel: false,
40+
},
41+
},
42+
}
43+
44+
type NavItem = {
45+
Icon: React.ElementType
46+
title: string
47+
ariaCurrent?: boolean
48+
}
49+
50+
type NavGroup = {
51+
title?: string
52+
items: NavItem[]
53+
}
54+
55+
const navGroups: NavGroup[] = [
56+
{
57+
items: [
58+
{Icon: GearIcon, title: 'General settings'},
59+
{Icon: CodeIcon, title: 'Developer settings'},
60+
],
61+
},
62+
{
63+
title: 'Access',
64+
items: [
65+
{Icon: CreditCardIcon, title: 'Billing and plans'},
66+
{Icon: MailIcon, title: 'Emails'},
67+
{Icon: ShieldLockIcon, title: 'Password and authentication'},
68+
{Icon: BroadcastIcon, title: 'Sessions'},
69+
{Icon: KeyIcon, title: 'SSH and GPG keys'},
70+
{Icon: OrganizationIcon, title: 'Organizations'},
71+
{Icon: GlobeIcon, title: 'Enterprises'},
72+
{Icon: ReportIcon, title: 'Moderation'},
73+
],
74+
},
75+
{
76+
title: 'Code, planning, and automation',
77+
items: [
78+
{Icon: RepoIcon, title: 'Repositories'},
79+
{Icon: CodespacesIcon, title: 'Codespaces'},
80+
{Icon: PackageIcon, title: 'Packages'},
81+
{Icon: CopilotIcon, title: 'Copilot'},
82+
{Icon: BrowserIcon, title: 'Pages'},
83+
{Icon: ReplyIcon, title: 'Saved replies'},
84+
],
85+
},
86+
{
87+
title: 'Security',
88+
items: [{Icon: ShieldLockIcon, title: 'Code security and analysis'}],
89+
},
90+
{
91+
title: 'Integrations',
92+
items: [
93+
{Icon: AppsIcon, title: 'Applications'},
94+
{Icon: ClockIcon, title: 'Scheduled reminders'},
95+
],
96+
},
97+
{
98+
title: 'Archives',
99+
items: [
100+
{Icon: LogIcon, title: 'Security log'},
101+
{Icon: LogIcon, title: 'Sponsorship log'},
102+
],
103+
},
104+
]
105+
106+
const data = [
107+
{name: 'John Doe', age: 30, occupation: 'Software Engineer'},
108+
{name: 'Jane Smith', age: 25, occupation: 'Product Manager'},
109+
{name: 'Bob Johnson', age: 35, occupation: 'UX Designer'},
110+
]
111+
112+
export const BorderDemo = () => {
113+
return (
114+
<>
115+
<Box sx={{backgroundColor: 'canvas.default', minHeight: '100vh'}}>
116+
<Box sx={{bg: 'canvas.inset', width: '100%', maxWidth: '100%'}}>
117+
<Box
118+
sx={{
119+
px: 3,
120+
pt: 3,
121+
pb: 3,
122+
display: 'flex',
123+
gap: 3,
124+
alignItems: 'center',
125+
borderBottomColor: 'border.default',
126+
borderBottomWidth: 1,
127+
borderBottomStyle: 'solid',
128+
}}
129+
>
130+
<IconButton icon={ThreeBarsIcon} aria-label="Menu" />
131+
<Octicon icon={MarkGithubIcon} size={32} />
132+
<Box sx={{display: 'flex', gap: 2}}>
133+
<Text sx={{fontSize: 1, fontWeight: 'bold'}}>Settings</Text>
134+
</Box>
135+
</Box>
136+
</Box>
137+
<PageLayout
138+
containerWidth="xlarge"
139+
sx={{
140+
pr: [0, 5, 5, 5, 5],
141+
pl: [0, 3, 3, 3, 3],
142+
maxWidth: 1280,
143+
backgroundColor: 'canvas.default',
144+
margin: '0 auto',
145+
borderColor: ['transparent', 'transparent', 'transparent', 'transparent', 'border.subtle'],
146+
}}
147+
>
148+
<PageLayout.Pane width="large" position="start" sx={{overflow: 'visible', mb: [0, 'inherit']}}>
149+
<Box sx={{px: 3, py: [0, 2]}}>
150+
<Box
151+
sx={{
152+
display: 'flex',
153+
alignItems: 'center',
154+
px: 2,
155+
borderColor: 'border.default',
156+
borderBottomWidth: ['1px', 'none'],
157+
borderBottomStyle: ['solid', 'none'],
158+
pb: [3, 0],
159+
mb: [2, 0],
160+
}}
161+
>
162+
{/* <GitHubAvatar src="https://github.com/ghavatar/u/9919?s=200&v=4" size={40} /> */}
163+
<Box sx={{ml: 2}}>
164+
<Box sx={{fontWeight: 'bold'}}>tbenning</Box>
165+
<Box sx={{fontSize: 1, color: 'fg.muted'}}>Personal account</Box>
166+
</Box>
167+
<Box sx={{ml: 'auto'}}>
168+
<IconButton icon={ArrowSwitchIcon} aria-label="Switch settings context" sx={{color: 'fg.subtle'}} />
169+
</Box>
170+
</Box>
171+
<Box sx={{display: ['none', 'block']}}>
172+
<NavList>
173+
{navGroups.map((group, groupIndex) => (
174+
<NavList.Group key={groupIndex} title={group.title}>
175+
{group.items.map((item, itemIndex) => (
176+
<NavList.Item key={itemIndex}>
177+
<NavList.LeadingVisual>
178+
<item.Icon />
179+
</NavList.LeadingVisual>
180+
{item.title}
181+
</NavList.Item>
182+
))}
183+
</NavList.Group>
184+
))}
185+
</NavList>
186+
</Box>
187+
</Box>
188+
</PageLayout.Pane>
189+
<PageLayout.Content>
190+
<Box sx={{py: 1, px: [3, 0, 0, 0, 0], display: 'flex', flexDirection: 'column', gap: 3}}>
191+
<h1>Heading</h1>
192+
<Box sx={{display: 'flex', gap: '8px'}}>
193+
<TextInput leadingVisual={SearchIcon} />
194+
<Button>A default button</Button>
195+
<Button variant="invisible">An invisible button</Button>
196+
<Button variant="primary">A primary button</Button>
197+
</Box>
198+
199+
<Box
200+
sx={{
201+
border: 'solid 1px var(--borderColor-default)',
202+
borderRadius: 'var(--borderRadius-medium)',
203+
backgroundColor: 'var(--bgColor-muted)',
204+
marginBottom: 'var(--base-size-24)',
205+
width: '100%',
206+
}}
207+
>
208+
<Box
209+
sx={{
210+
padding: 'var(--base-size-8)',
211+
borderBottom: 'solid 1px var(--borderColor-default)',
212+
display: 'flex',
213+
gap: '8px',
214+
}}
215+
>
216+
<Button>A default button</Button>
217+
<Button variant="invisible">An invisible button</Button>
218+
<SegmentedControl aria-label="File view">
219+
<SegmentedControl.IconButton defaultSelected aria-label={'Preview'} icon={EyeIcon} />
220+
<SegmentedControl.IconButton aria-label={'Raw'} icon={FileCodeIcon} />
221+
<SegmentedControl.IconButton aria-label={'Blame'} icon={PeopleIcon} />
222+
</SegmentedControl>
223+
</Box>
224+
<Box sx={{backgroundColor: 'var(--bgColor-default)', padding: 'var(--base-size-36)'}}>
225+
This is a box oh wow
226+
</Box>
227+
</Box>
228+
<Table.Container>
229+
<h1 className="sr-only" id="table-heading">
230+
Avatar
231+
</h1>
232+
<DataTable
233+
aria-labelledby="table-heading"
234+
data={data}
235+
columns={[
236+
{header: 'Name', field: 'name', rowHeader: true},
237+
{header: 'Age', field: 'age'},
238+
{header: 'Occupation', field: 'occupation'},
239+
]}
240+
/>
241+
</Table.Container>
242+
</Box>
243+
</PageLayout.Content>
244+
</PageLayout>
245+
</Box>
246+
</>
247+
)
248+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[data-color-mode='light'],
2+
[data-color-mode='dark'] {
3+
/* --bgColor-muted: var(--base-display-color-grayWhite) !important;
4+
--bgColor-inset: var(--base-display-color-grayWhite) !important;
5+
--bgColor-emphasis: var(--base-display-color-gray-9) !important;
6+
--bgColor-disabled: var(--base-display-color-gray-1) !important;
7+
--bgColor-neutral-muted: var(--base-display-color-gray-3) !important;
8+
--bgColor-neutral-emphasis: var(--base-display-color-gray-5) !important;
9+
--borderColor-default: var(--base-display-color-gray-2) !important;
10+
--borderColor-muted: var(--base-display-color-gray-1) !important;
11+
--borderColor-emphasis: var(--base-display-color-gray-5) !important;
12+
--borderColor-neutral-muted: var(--base-display-color-gray-3) !important;
13+
--borderColor-neutral-emphasis: var(--base-display-color-gray-5) !important;
14+
--fgColor-muted: var(--base-display-color-gray-6) !important;
15+
--fgColor-disabled: var(--base-display-color-gray-4) !important;
16+
--fgColor-neutral: var(--base-display-color-gray-5) !important; */
17+
/* patterns */
18+
/* --button-default-borderColor-rest: var(--base-display-color-gray-5) !important;
19+
--button-default-borderColor-active: var(--base-display-color-gray-5) !important;
20+
--button-default-borderColor-hover: var(--base-display-color-gray-5) !important; */
21+
/* --button-primary-bgColor-rest: var(--base-display-color-green-5) !important;
22+
--button-primary-borderColor-rest: var(--base-display-color-green-7) !important; */
23+
/* --control-bgColor-rest: var(--base-display-color-gray-0) !important;
24+
--control-bgColor-hover: var(--base-display-color-gray-1) !important;
25+
--control-bgColor-active: var(--base-display-color-gray-) !important;
26+
--control-borderColor-rest: var(--base-display-color-gray-5) !important;
27+
--controlTrack-bgColor-rest: var(--base-display-color-gray-0) !important; */
28+
}
29+
30+
[data-color-mode='dark'] {
31+
/* --bgColor-muted: var(--base-display-color-black) !important;
32+
--bgColor-inset: var(--base-display-color-black) !important; */
33+
/* --control-bgColor-default: var(--base-display-color-gray-1) !important; */
34+
/* --control-transparent-bgColor-hover: var(--base-display-color-gray-1) !important;
35+
--control-transparent-bgColor-active: var(--base-display-color-gray-2) !important;
36+
--control-borderColor-rest: var(--base-display-color-gray-5) !important; */
37+
/* --controlTrack-bgColor-rest: var(--base-display-color-gray-0) !important; */
38+
/* --button-default-bgColor-rest: var(--base-display-color-gray-1) !important;
39+
--button-default-bgColor-hover: var(--base-display-color-gray-2) !important;
40+
--button-default-bgColor-active: var(--base-display-color-gray-3) !important; */
41+
}

src/tokens/base/color/dark/dark.dimmed.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
},
4545
},
46-
gray: {
46+
neutral: {
4747
'0': {
4848
$value: '#cdd9e5',
4949
$type: 'color',

src/tokens/base/color/dark/dark.high-contrast.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
},
2525
},
26-
gray: {
26+
neutral: {
2727
'0': {
2828
$value: '#ffffff',
2929
$type: 'color',

src/tokens/base/color/dark/dark.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
alpha: 0,
3535
},
36-
gray: {
36+
neutral: {
3737
'0': {
3838
$value: '#f0f6fc',
3939
$type: 'color',

src/tokens/base/color/light/light.high-contrast.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
},
1616
},
17-
gray: {
17+
neutral: {
1818
'0': {
1919
$value: '#ffffff',
2020
$type: 'color',

src/tokens/base/color/light/light.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
},
3535
},
36-
gray: {
36+
neutral: {
3737
'0': {
3838
$value: '#f6f8fa',
3939
$type: 'color',

src/tokens/functional/color/dark/app-dark.json5

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
syntax: {
373373
fgColor: {
374374
comment: {
375-
$value: '{base.color.gray.3}',
375+
$value: '{base.color.neutral.3}',
376376
$type: 'color',
377377
$extensions: {
378378
'org.primer.figma': {
@@ -499,7 +499,7 @@
499499
},
500500
},
501501
bgColor: {
502-
$value: '{base.color.gray.9}',
502+
$value: '{base.color.neutral.9}',
503503
$type: 'color',
504504
$extensions: {
505505
'org.primer.figma': {
@@ -512,7 +512,7 @@
512512
},
513513
borderColor: {
514514
divider: {
515-
$value: '{base.color.gray.3}',
515+
$value: '{base.color.neutral.3}',
516516
$type: 'color',
517517
$extensions: {
518518
'org.primer.figma': {
@@ -527,7 +527,7 @@
527527
},
528528
headerSearch: {
529529
bgColor: {
530-
$value: '{base.color.gray.9}',
530+
$value: '{base.color.neutral.9}',
531531
$type: 'color',
532532
$extensions: {
533533
'org.primer.figma': {
@@ -539,7 +539,7 @@
539539
},
540540
},
541541
borderColor: {
542-
$value: '{base.color.gray.6}',
542+
$value: '{base.color.neutral.6}',
543543
$type: 'color',
544544
$extensions: {
545545
'org.primer.figma': {

0 commit comments

Comments
 (0)