-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Header): Convert Header to CSS modules behind team feature flag (#…
…5192) * feat(Header): Convert Header to CSS modules behind team feature flag * dev stories * prettier fix * update types * Fix missing 'as' prop and update tests * format * replace full class with data attr
- Loading branch information
1 parent
002be35
commit cbeed21
Showing
7 changed files
with
315 additions
and
58 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 `Header` component to use CSS modules behind the feature flag primer_react_css_modules_team |
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,11 @@ | ||
.HeaderDev { | ||
background-color: var(--label-olive-bgColor-active); | ||
} | ||
|
||
.HeaderDevItem { | ||
padding-left: var(--base-size-24); | ||
} | ||
|
||
.HeaderDevLink { | ||
color: var(--color-prettylights-syntax-markup-inserted-text); | ||
} |
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,76 @@ | ||
import React from 'react' | ||
import type {Meta} from '@storybook/react' | ||
import {MarkGithubIcon} from '@primer/octicons-react' | ||
|
||
import Header from './Header' | ||
import Avatar from '../Avatar' | ||
import Octicon from '../Octicon' | ||
|
||
import classes from './Header.dev.module.css' | ||
import {FeatureFlags} from '../FeatureFlags' | ||
|
||
export default { | ||
title: 'Components/Header/Dev', | ||
component: Header, | ||
} as Meta<typeof Header> | ||
|
||
export const WithCss = () => ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<Header as="summary" className={classes.HeaderDev}> | ||
<Header.Item id="github"> | ||
<Header.Link href="#" className={classes.HeaderDevLink}> | ||
<Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} /> | ||
<span>GitHub</span> | ||
</Header.Link> | ||
</Header.Item> | ||
<Header.Item full>Menu</Header.Item> | ||
<Header.Item className={classes.HeaderDevItem}> | ||
<Avatar src="https://github.com/octocat.png" size={20} square alt="@octocat" /> | ||
</Header.Item> | ||
</Header> | ||
</FeatureFlags> | ||
) | ||
|
||
export const WithSx = () => ( | ||
<Header as="summary" sx={{backgroundColor: 'blue'}}> | ||
<Header.Item id="github"> | ||
<Header.Link href="#" sx={{fontSize: 3}}> | ||
<Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} /> | ||
<span>GitHub</span> | ||
</Header.Link> | ||
</Header.Item> | ||
<Header.Item full>Menu</Header.Item> | ||
<Header.Item sx={{mr: 2}}> | ||
<Avatar src="https://github.com/octocat.png" size={20} square alt="@octocat" /> | ||
</Header.Item> | ||
</Header> | ||
) | ||
|
||
export const WithSxAndCSS = () => ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<Header as="summary" className={classes.HeaderDev} sx={{backgroundColor: 'orange'}}> | ||
<Header.Item id="github"> | ||
<Header.Link href="#" className={classes.HeaderDevLink} sx={{p: 0, color: 'black'}}> | ||
<Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} /> | ||
<span>GitHub</span> | ||
</Header.Link> | ||
</Header.Item> | ||
<Header.Item full>Menu</Header.Item> | ||
<Header.Item className={classes.HeaderDevItem} sx={{m: 0}}> | ||
<Avatar src="https://github.com/octocat.png" size={20} square alt="@octocat" /> | ||
</Header.Item> | ||
</Header> | ||
</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,39 @@ | ||
.Header { | ||
z-index: 32; | ||
display: flex; | ||
padding: var(--base-size-16); | ||
overflow: auto; | ||
font-size: var(--text-body-size-medium); | ||
line-height: var(--text-title-lineHeight-large); | ||
color: var(--header-fgColor-default); | ||
background-color: var(--header-bgColor); | ||
align-items: center; | ||
flex-wrap: nowrap; | ||
} | ||
|
||
.HeaderItem { | ||
display: flex; | ||
margin-right: var(--base-size-16); | ||
align-self: stretch; | ||
align-items: center; | ||
flex-wrap: nowrap; | ||
|
||
&:where([data-full]) { | ||
flex: auto; | ||
} | ||
} | ||
|
||
.HeaderLink { | ||
display: flex; | ||
font-weight: var(--text-title-weight-large); | ||
color: var(--header-fgColor-logo); | ||
text-decoration: none; | ||
white-space: nowrap; | ||
cursor: pointer; | ||
align-items: center; | ||
|
||
&:hover, | ||
&:focus { | ||
color: var(--header-fgColor-default); | ||
} | ||
} |
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
Oops, something went wrong.