-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SubNav): Convert SubNav to CSS modules behind team feature flag (#…
…5202) * feat(SubNav): Convert SubNav to CSS modules behind team feature flag * update border color var * update line height * revert border var change * add vrt tests * test(vrt): update snapshots --------- Co-authored-by: hussam-i-am <hussam-i-am@users.noreply.github.com>
- Loading branch information
1 parent
b9749d4
commit 293c574
Showing
34 changed files
with
373 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
Update `SubNav` component to use CSS modules behind the feature flag primer_react_css_modules_team |
Binary file added
BIN
+7.97 KB
...omponents/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.91 KB
...ts/components/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.06 KB
...onents/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.98 KB
...snapshots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.97 KB
...omponents/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.91 KB
...mponents/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.03 KB
...nents/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
...napshots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.93 KB
...mponents/SubNav.test.ts-snapshots/SubNav-Dev-WithCSS-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.96 KB
...components/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.87 KB
...ots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
...ponents/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
.../snapshots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
...components/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.93 KB
...omponents/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.03 KB
...onents/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.93 KB
...snapshots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.93 KB
...omponents/SubNav.test.ts-snapshots/SubNav-Dev-WithSx-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.96 KB
...ents/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.23 KB
...mponents/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
...s/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
...hots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.94 KB
...ents/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.93 KB
...nts/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.03 KB
.../SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.93 KB
...ots/components/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.93 KB
...nts/SubNav.test.ts-snapshots/SubNav-Dev-WithSxAndCSS-light-tritanopia-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.SubNavDev { | ||
padding: var(--base-size-4); | ||
border: var(--borderWidth-thick) solid var(--borderColor-default); | ||
} | ||
|
||
.SubNavLinksDev { | ||
margin: var(--base-size-8); | ||
} | ||
|
||
.SubNavLinkDev { | ||
font-weight: var(--text-title-weight-large); | ||
color: var(--fgColor-accent); | ||
|
||
&:is([data-selected]) { | ||
background-color: var(--bgColor-open-emphasis); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React from 'react' | ||
import type {Meta} from '@storybook/react' | ||
import SubNav from './SubNav' | ||
import type {ComponentProps} from '../utils/types' | ||
import {FeatureFlags} from '../FeatureFlags' | ||
|
||
import styles from './SubNav.dev.module.css' | ||
|
||
export default { | ||
title: 'Components/SubNav/Dev', | ||
component: SubNav, | ||
subcomponents: { | ||
'SubNav.Link': SubNav.Link, | ||
}, | ||
} as Meta<ComponentProps<typeof SubNav>> | ||
|
||
export const WithCss = () => ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<SubNav aria-label="Main" className={styles.SubNavDev}> | ||
<SubNav.Links className={styles.SubNavLinksDev}> | ||
<SubNav.Link href="#home" selected className={styles.SubNavLinkDev}> | ||
Home | ||
</SubNav.Link> | ||
<SubNav.Link href="#documentation" className={styles.SubNavLinkDev}> | ||
Documentation | ||
</SubNav.Link> | ||
<SubNav.Link href="#support" className={styles.SubNavLinkDev}> | ||
Support | ||
</SubNav.Link> | ||
</SubNav.Links> | ||
</SubNav> | ||
</FeatureFlags> | ||
) | ||
|
||
export const WithSx = () => ( | ||
<SubNav aria-label="Main" sx={{p: 1, display: 'flex', border: '2px solid', borderColor: 'border.default'}}> | ||
<SubNav.Links sx={{m: 2}}> | ||
<SubNav.Link | ||
href="#home" | ||
selected | ||
sx={{color: 'accent.fg', fontWeight: 'bold', '&:is([data-selected])': {backgroundColor: 'danger.fg'}}} | ||
> | ||
Home | ||
</SubNav.Link> | ||
<SubNav.Link href="#documentation" sx={{color: 'accent.fg', fontWeight: 'bold'}}> | ||
Documentation | ||
</SubNav.Link> | ||
<SubNav.Link href="#support" sx={{color: 'accent.fg', fontWeight: 'bold'}}> | ||
Support | ||
</SubNav.Link> | ||
</SubNav.Links> | ||
</SubNav> | ||
) | ||
|
||
export const WithSxAndCSS = () => ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<SubNav | ||
aria-label="Main" | ||
sx={{p: 1, display: 'flex', border: '2px solid', borderColor: 'border.default'}} | ||
className={styles.SubNavDev} | ||
> | ||
<SubNav.Links sx={{m: 2}} className={styles.SubNavLinksDev}> | ||
<SubNav.Link | ||
href="#home" | ||
selected | ||
className={styles.SubNavLinkDev} | ||
sx={{'&:is([data-selected])': {backgroundColor: 'danger.fg'}}} | ||
> | ||
Home | ||
</SubNav.Link> | ||
<SubNav.Link href="#documentation" className={styles.SubNavLinkDev}> | ||
Documentation | ||
</SubNav.Link> | ||
<SubNav.Link href="#support" sx={{color: 'accent.fg', fontWeight: 'bold'}} className={styles.SubNavLinkDev}> | ||
Support | ||
</SubNav.Link> | ||
</SubNav.Links> | ||
</SubNav> | ||
</FeatureFlags> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
.SubNav { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.Body { | ||
display: flex; | ||
/* stylelint-disable-next-line primer/spacing */ | ||
margin-bottom: -1px; | ||
|
||
& > * { | ||
margin-left: var(--base-size-8); | ||
} | ||
|
||
& > *:first-child { | ||
margin-left: 0; | ||
} | ||
} | ||
|
||
.Actions { | ||
align-self: center; | ||
} | ||
|
||
.Links { | ||
display: flex; | ||
} | ||
|
||
.Link { | ||
display: flex; | ||
min-height: 34px; /* custom values for SubNav */ | ||
padding-right: var(--base-size-16); | ||
padding-left: var(--base-size-16); | ||
font-size: var(--text-body-size-medium); | ||
font-weight: var(--base-text-weight-medium); | ||
/* stylelint-disable-next-line primer/typography */ | ||
line-height: 20px; /* custom values for SubNav */ | ||
color: var(--fgColor-default); | ||
text-align: center; | ||
text-decoration: none; | ||
border-top: var(--borderWidth-thin) solid var(--borderColor-default); | ||
border-right: var(--borderWidth-thin) solid var(--borderColor-default); | ||
border-bottom: var(--borderWidth-thin) solid var(--borderColor-default); | ||
align-items: center; | ||
|
||
&:first-of-type { | ||
border-left: var(--borderWidth-thin) solid var(--borderColor-default); | ||
border-top-left-radius: var(--borderRadius-medium); | ||
border-bottom-left-radius: var(--borderRadius-medium); | ||
} | ||
|
||
&:last-of-type { | ||
border-top-right-radius: var(--borderRadius-medium); | ||
border-bottom-right-radius: var(--borderRadius-medium); | ||
} | ||
|
||
&:hover, | ||
&:focus { | ||
text-decoration: none; | ||
background-color: var(--bgColor-muted); | ||
transition: background-color 0.2s ease; | ||
} | ||
|
||
&:is([data-selected]) { | ||
color: var(--fgColor-onEmphasis); | ||
background-color: var(--bgColor-accent-emphasis); | ||
/* stylelint-disable-next-line primer/colors */ | ||
border-color: var(--bgColor-accent-emphasis); | ||
} | ||
} |
Oops, something went wrong.