-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: New gcds-notice component (#627)
* First commit: new gcds-notice component * gcds-notice stories * gcds-notice spec and e2e tests * fix CSS + format index.html * Storybook fixes + upodate notice to use section * Update to new tokens package version * PR feedback: Notice formatting + clean up * Remove unused line of CSS * Add missing lang attribute in storybook * PR feedback: fix typos * First version of icon notice * Update notice component to use icon instead of text label * Update spec unit tests * Update icon selection method * Update tokens package * PR feedback * Add new notice-title-tag property * Fix notice-title-tag comment * Add invalid tag value test * Modify internal heading margin-top to new spacing token value * fix: notice heading spacing * Update tokens package version
- Loading branch information
1 parent
9ea1447
commit bb98233
Showing
16 changed files
with
1,071 additions
and
1 deletion.
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
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
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
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
110 changes: 110 additions & 0 deletions
110
packages/web/src/components/gcds-notice/gcds-notice.css
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,110 @@ | ||
@layer reset, default, type; | ||
|
||
@layer reset { | ||
:host { | ||
display: block; | ||
|
||
.gcds-notice { | ||
text-align: left; | ||
box-sizing: border-box; | ||
|
||
slot { | ||
display: initial; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@layer default { | ||
:host .gcds-notice { | ||
color: var(--gcds-notice-text); | ||
display: grid; | ||
grid-template-columns: var(--gcds-notice-icon-width) auto; | ||
gap: var(--gcds-notice-icon-gap); | ||
|
||
.notice__heading { | ||
--gcds-heading-h2-desktop: var( | ||
--gcds-notice-content-heading-font-desktop | ||
); | ||
--gcds-heading-h2-mobile: var(--gcds-notice-content-heading-font-mobile); | ||
--gcds-heading-h4-desktop: var( | ||
--gcds-notice-content-heading-font-desktop | ||
); | ||
--gcds-heading-h4-mobile: var(--gcds-notice-content-heading-font-mobile); | ||
--gcds-heading-h5-desktop: var( | ||
--gcds-notice-content-heading-font-desktop | ||
); | ||
--gcds-heading-h5-mobile: var(--gcds-notice-content-heading-font-mobile); | ||
margin-block-start: var(--gcds-notice-content-heading-margin-block-start-desktop); | ||
|
||
@media only screen and (width < 48em) { | ||
margin-block-start: var(--gcds-notice-content-heading-margin-block-start-mobile); | ||
} | ||
} | ||
|
||
.notice__icon { | ||
margin: var(--gcds-notice-icon-margin); | ||
|
||
&:before { | ||
display: block; | ||
width: var(--gcds-notice-border-width); | ||
margin: 0 auto; | ||
height: var(--gcds-notice-icon-before-height); | ||
content: ''; | ||
background-color: currentColor; | ||
} | ||
|
||
&:after { | ||
display: block; | ||
width: var(--gcds-notice-border-width); | ||
margin: 0 auto; | ||
height: var(--gcds-notice-icon-after-height); | ||
content: ''; | ||
background-color: currentColor; | ||
} | ||
} | ||
|
||
::slotted(*) { | ||
margin-block-start: 0; | ||
font: var(--gcds-notice-content-slotted-font-desktop); | ||
|
||
@media only screen and (width < 48em) { | ||
font: var(--gcds-notice-content-slotted-font-mobile); | ||
} | ||
} | ||
|
||
::slotted(*:last-child) { | ||
margin-block-end: 0; | ||
} | ||
|
||
::slotted(*:not(:last-child)) { | ||
margin-block-end: var(--gcds-notice-content-slotted-margin); | ||
} | ||
|
||
::slotted(ol), | ||
::slotted(ul) { | ||
margin-inline-start: var(--gcds-notice-content-slotted-list-margin); | ||
padding: 0; | ||
} | ||
} | ||
} | ||
|
||
@layer type { | ||
:host .gcds-notice { | ||
&.notice--type-danger .notice__icon { | ||
color: var(--gcds-notice-danger-text); | ||
} | ||
|
||
&.notice--type-info .notice__icon { | ||
color: var(--gcds-notice-info-text); | ||
} | ||
|
||
&.notice--type-success .notice__icon { | ||
color: var(--gcds-notice-success-text); | ||
} | ||
|
||
&.notice--type-warning .notice__icon { | ||
color: var(--gcds-notice-warning-text); | ||
} | ||
} | ||
} |
Oops, something went wrong.