-
Notifications
You must be signed in to change notification settings - Fork 648
feat(Banner): update Banner to use CSS Modules behind feature flag #4913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c43094e
feat(Banner): update Banner to use CSS Modules behind feature flag
joshblack 630f564
chore: add changeset
joshblack 3c182a8
chore: remove autogenerated pnpm packageManager change
joshblack 6a08c89
chore: fix stylelint errors
joshblack 684b3ab
chore: add back in underline for fallback case
joshblack 0ff7604
Merge branch 'main' of github.com:primer/react into refactor/update-b…
joshblack 5816c16
Merge branch 'main' into refactor/update-banner-to-css-modules
joshblack 3f3e277
refactor: update autofix and eslint warning
joshblack 9583dcc
Merge branch 'main' of github.com:primer/react into refactor/update-b…
joshblack c958118
chore: update class order for tests
joshblack fe7af8e
Merge branch 'main' into refactor/update-banner-to-css-modules
joshblack 93cdc80
chore: fix stylelint errors
joshblack c42a412
Update packages/react/src/Banner/Banner.module.css
joshblack 0d22244
Merge branch 'main' of github.com:primer/react into refactor/update-b…
joshblack 4bf2a22
Merge branch 'refactor/update-banner-to-css-modules' of github.com:pr…
joshblack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 Banner to use CSS Modules behind feature flag |
This file contains hidden or 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 hidden or 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 hidden or 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,194 @@ | ||
| .Banner { | ||
| display: grid; | ||
| padding: var(--base-size-8); | ||
| background-color: var(--banner-bgColor); | ||
| border: var(--borderWidth-thin, 1px) solid var(--banner-borderColor); | ||
| border-radius: var(--borderRadius-medium); | ||
| grid-template-columns: auto minmax(0, 1fr) auto; | ||
| align-items: start; | ||
|
|
||
| @supports (container-type: inline-size) { | ||
| container: banner / inline-size; | ||
| } | ||
|
|
||
| &[data-variant='critical'] { | ||
| --banner-bgColor: var(--bgColor-danger-muted); | ||
| --banner-borderColor: var(--borderColor-danger-muted); | ||
| --banner-icon-fgColor: var(--fgColor-danger); | ||
| } | ||
|
|
||
| &[data-variant='info'] { | ||
| --banner-bgColor: var(--bgColor-accent-muted); | ||
| --banner-borderColor: var(--borderColor-accent-muted); | ||
| --banner-icon-fgColor: var(--fgColor-accent); | ||
| } | ||
|
|
||
| &[data-variant='success'] { | ||
| --banner-bgColor: var(--bgColor-success-muted); | ||
| --banner-borderColor: var(--borderColor-success-muted); | ||
| --banner-icon-fgColor: var(--fgColor-success); | ||
| } | ||
|
|
||
| &[data-variant='upsell'] { | ||
| --banner-bgColor: var(--bgColor-upsell-muted); | ||
| --banner-borderColor: var(--borderColor-upsell-muted); | ||
| --banner-icon-fgColor: var(--fgColor-upsell); | ||
| } | ||
|
|
||
| &[data-variant='warning'] { | ||
| --banner-bgColor: var(--bgColor-attention-muted); | ||
| --banner-borderColor: var(--borderColor-attention-muted); | ||
| --banner-icon-fgColor: var(--fgColor-attention); | ||
| } | ||
| } | ||
|
|
||
| /* BannerContainer -------------------------------------------------------- */ | ||
|
|
||
| .BannerContainer { | ||
| font-size: var(--text-body-size-medium); | ||
| align-items: start; | ||
| line-height: var(--text-body-lineHeight-medium)); | ||
| row-gap: var(--base-size-4); | ||
| column-gap: var(--base-size-4); | ||
| } | ||
|
|
||
| .Banner :where(.BannerContainer) { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .Banner[data-dismissible]:not([data-title-hidden='']) .BannerContainer { | ||
| display: grid; | ||
| grid-template-columns: auto; | ||
| grid-template-rows: auto; | ||
| } | ||
|
|
||
| /* BannerContent ---------------------------------------------------------- */ | ||
|
|
||
| .BannerContent { | ||
| display: grid; | ||
| row-gap: var(--base-size-4); | ||
| grid-column-start: 1; | ||
| margin-block: var(--base-size-8); | ||
| } | ||
|
|
||
| .Banner[data-title-hidden] .BannerContent { | ||
| margin-block: var(--base-size-6); | ||
| } | ||
|
|
||
| @media screen and (min-width: 544px) { | ||
| .BannerContent { | ||
| flex: 1 1 0%; | ||
| } | ||
| } | ||
|
|
||
| .BannerTitle { | ||
| margin: 0; | ||
| font-size: inherit; | ||
| font-weight: var(--base-text-weight-semibold); | ||
| } | ||
|
|
||
| /* BannerIcon ------------------------------------------------------------- */ | ||
|
|
||
| .BannerIcon { | ||
| display: grid; | ||
| place-items: center; | ||
| padding: var(--base-size-8); | ||
| } | ||
|
|
||
| .BannerIcon svg { | ||
| /* 20px is the line box height of the trailing action buttons */ | ||
| height: var(--base-size-20); | ||
| color: var(--banner-icon-fgColor); | ||
| fill: var(--banner-icon-fgColor); | ||
| } | ||
|
|
||
| .Banner[data-title-hidden] .BannerIcon svg { | ||
| height: var(--base-size-16); | ||
| } | ||
|
|
||
| /* BannerDismiss ---------------------------------------------------------- */ | ||
|
|
||
| .BannerDismiss { | ||
| display: grid; | ||
| place-items: center; | ||
| padding: var(--base-size-8); | ||
| margin-inline-start: var(--base-size-4); | ||
| } | ||
|
|
||
| .BannerDismiss svg { | ||
| color: var(--banner-icon-fgColor); | ||
| } | ||
|
|
||
| /* BannerActions ---------------------------------------------------------- */ | ||
|
|
||
| .BannerActionsContainer { | ||
| display: flex; | ||
| column-gap: var(--base-size-12); | ||
| align-items: center; | ||
| } | ||
|
|
||
| .BannerActions :where([data-primary-action='trailing']) { | ||
| display: none; | ||
| } | ||
|
|
||
| @media screen and (--viewportRange-regular) { | ||
| .BannerActions :where([data-primary-action='trailing']) { | ||
| display: flex; | ||
| } | ||
|
|
||
| .BannerActions :where([data-primary-action='leading']) { | ||
| display: none; | ||
| } | ||
| } | ||
|
|
||
| .Banner[data-dismissible] .BannerActions { | ||
| margin-block-end: var(--base-size-6); | ||
| } | ||
|
|
||
| .Banner[data-dismissible]:not([data-title-hidden]) .BannerActionsContainer[data-primary-action='trailing'] { | ||
| display: none; | ||
| } | ||
|
|
||
| .Banner[data-dismissible]:not([data-title-hidden]) .BannerActionsContainer[data-primary-action='leading'] { | ||
| display: flex; | ||
| } | ||
|
|
||
| /* Layout ------------------------------------------------------------------- */ | ||
|
|
||
| /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ | ||
| @container banner (max-width: 500px) { | ||
| .BannerContainer { | ||
| display: grid; | ||
| grid-template-rows: auto auto; | ||
| } | ||
|
|
||
| .BannerActions { | ||
| margin-block-end: var(--base-size-6); | ||
| } | ||
|
|
||
| .BannerActions [data-primary-action='trailing'] { | ||
| display: none; | ||
| } | ||
|
|
||
| .BannerActions [data-primary-action='leading'] { | ||
| display: flex; | ||
| } | ||
| } | ||
|
|
||
| /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ | ||
| @container banner (min-width: 500px) { | ||
| .BannerContainer { | ||
| display: grid; | ||
| grid-template-columns: auto auto; | ||
| } | ||
|
|
||
| .BannerActions [data-primary-action='trailing'] { | ||
| display: flex; | ||
| } | ||
|
|
||
| .BannerActions [data-primary-action='leading'] { | ||
| display: none; | ||
| } | ||
| } | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.