Skip to content
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .changeset/lazy-teachers-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@stackoverflow/stacks": minor
"@stackoverflow/stacks-svelte": minor
---

feat(notice): update styles for SHINE

BREAKING CHANGES
* Markup for notices has been updated
5 changes: 5 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ The menu component has been updated to use new class names and structure. The fo
- New `.s-navigation--icon` class to style icons alongside navigation items
- New `.s-navigation--avatar` class to style avatars alongside navigation items

#### Notices
- Markup has been been updated
- New `.s-notice--icon` class to style the new notice icons
- New `.s-notice--dismiss` class to style the optional dismiss button

#### Pagination
- The next and previous button now uses an `ArrowRight` and `ArrowLeft` icon instead of text. To apply the new styling, use the class `.s-pagination--item__nav`. Since these buttons use icons to represent their behavior, make sure to include descriptive text for screen readers.

Expand Down
149 changes: 76 additions & 73 deletions packages/stacks-classic/lib/components/notice/notice.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,18 @@
*/
.generate-variant-variables(@colorName: "", @modifier: "") {
& when (@modifier = "") {
--_no-bc: ~"var(--@{colorName}-300)";
--_no-bg: ~"var(--@{colorName}-100)";
--_no-btn-bg-active: ~"var(--@{colorName}-200)";
--_no-btn-bg-focus: ~"var(--@{colorName}-200)";
--_no-btn-fc: ~"var(--@{colorName}-500)";
--_no-icon-bg: ~"var(--@{colorName}-200)";
--_no-code-bc: ~"var(--@{colorName}-300)";
--_no-code-bg: ~"var(--@{colorName}-200)";

.highcontrast-mode({
--_no-bc: ~"var(--@{colorName}-400)";
});
}

& when (@modifier = important) {
--_no-bc: var(--_no-bg);
--_no-bg: ~"var(--@{colorName}-400)";
--_no-icon-bg: ~"var(--@{colorName}-500)";
--_no-fc: var(--white);
--_no-btn-bg-active: ~"var(--@{colorName}-500)";
--_no-btn-bg-focus: ~"var(--@{colorName}-500)";
--_no-btn-fc: ~"var(--@{colorName}-100)";
--_no-code-bc: ~"var(--@{colorName}-300)";
--_no-code-bg: ~"var(--@{colorName}-500)";

.highcontrast-mode({
--_no-bg: ~"var(--@{colorName}-500)";
});
}
}

Expand All @@ -47,47 +33,27 @@
* @baseClass - The base class name for the notice component
*/
.construct-notice-component(@baseClass) {
--_no-bc: var(--black-225);
--_no-bg: var(--black-100);
--_no-fc: var(--black-500);
--_no-btn-bg-active: var(--black-250);
--_no-btn-bg-focus: var(--black-225);
--_no-btn-fc: var(--_no-fc);
--_no-bg: var(--black-150);
--_no-icon-bg: var(--black-200);
--_no-fc: var(--black-600);
--_no-code-bc: var(--black-300);
--_no-code-bg: var(--black-200);
--_no-code-fc: var(--_no-fc);

// CONTEXTUAL STYLES
.highcontrast-mode({
&,
&.@{baseClass}__danger,
&.@{baseClass}__info,
&.@{baseClass}__success,
&.@{baseClass}__warning {
--_no-code-bc: var(--black-400);
--_no-code-bg: var(--white);
--_no-code-fc: var(--black);

&.@{baseClass}__important {
--_no-code-bc: var(--black-200);
--_no-code-bg: var(--black);
--_no-code-fc: var(--white);
}
&:not(&__important) {
--_no-icon-bc: var(--_no-code-bc);
}

--_no-bc: var(--black-400);
});

// MODIFIERS
&__important:not(.@{baseClass}__danger):not(.@{baseClass}__info):not(.@{baseClass}__success):not(.@{baseClass}__warning) {
--_no-bc: var(--_no-bg);
--_no-bg: var(--black-500);
&__important {
--_no-bg: var(--black-400);
--_no-icon-bg: var(--black-500);
--_no-fc: var(--white);
--_no-btn-bg-focus: var(--black-600);
--_no-btn-bg-active: var(--black-600);
--_no-btn-fc: var(--_no-fc);
--_no-code-bc: var(--black-300);
--_no-code-bg: var(--black-600);
--_no-code-bg: var(--black-500);
}

// VARIANTS
Expand All @@ -103,11 +69,11 @@

&__info {
&:not(.@{baseClass}__important) {
.generate-variant-variables(theme-secondary);
.generate-variant-variables(blue);
}

&.@{baseClass}__important {
.generate-variant-variables(theme-secondary, important);
.generate-variant-variables(blue, important);
}
}

Expand All @@ -121,33 +87,57 @@
}
}

&__featured {
&:not(.@{baseClass}__important) {
.generate-variant-variables(purple);
}

&.@{baseClass}__important {
.generate-variant-variables(purple, important);
}
}

&__activity {
&:not(.@{baseClass}__important) {
.generate-variant-variables(pink);
}

&.@{baseClass}__important {
.generate-variant-variables(pink, important);
}
}

&__warning {
&:not(.@{baseClass}__important) {
.generate-variant-variables(yellow);
--_no-btn-fc: var(--yellow-600);

}

&.@{baseClass}__important {
--_no-bc: var(--_no-bg);
--_no-bg: var(--yellow-400);
--_no-bg: var(--yellow-300);
--_no-icon-bg: var(--yellow-400);
--_no-fc: var(--black);
--_no-btn-fc: var(--_no-fc);
--_no-btn-bg-active: var(--yellow-300);
--_no-btn-bg-focus: var(--yellow-300);
--_no-code-bc: var(--yellow-500);
--_no-code-bg: var(--yellow-300);
--_no-code-bc: var(--yellow-400);
--_no-code-bg: var(--yellow-200);

.s-notice--icon {
color: var(--white);
}

.dark-mode({
--_no-fc: var(--white);
--_no-code-bc: var(--yellow-300);
--_no-code-bg: var(--yellow-500);
--_no-bg: var(--yellow-400);
--_no-icon-bg: var(--yellow-500);
});

.highcontrast-mode({
--_no-bg: var(--yellow-500);
--_no-bg: var(--yellow-400);
--_no-icon-bg: var(--yellow-500);
--_no-code-bc: var(--yellow-300);
--_no-code-bg: var(--yellow-500);
--_no-fc: var(--white);
--_no-btn-bg-active: transparent;
--_no-btn-bg-focus: transparent;
});
}
}
Expand All @@ -157,41 +147,54 @@
background-color: var(--_no-code-bg);
color: var(--_no-code-fc);
outline: var(--su-static1) solid var(--_no-code-bc);

border-radius: var(--br-md);
padding-left: var(--su2);
padding-right: var(--su2);
}

& &--btn {
// TODO: decouple .s-notice--btn from .s-btn
button&--dismiss {
Comment on lines -167 to +154
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced s-notice--dismiss class here to make the dismiss button more explicit and style it accordingly.

&:active {
background-color: var(--_no-btn-bg-active, inherit) !important;
background-color: var(--_no-fc);
color: var(--_no-bg);
}

&:focus-visible,
&:hover,
&.focus-inset-bordered {
background-color: var(--_no-btn-bg-focus, inherit) !important;
background-color: var(--_no-fc);
color: var(--_no-bg);
}

color: var(--_no-btn-fc, inherit) !important;
padding: var(--su8);
margin-left: calc(var(--su24) - var(--su2)); //22px
margin-right: var(--su12);

.svg-icon {
margin: 0px var(--su2) var(--su2) var(--su2);
}
}

// STYLES MODIFIED BY COMPONENT-SPECIFIC CUSTOM PROPERTIES
background: var(--_no-bg);
border-color: var(--_no-bc);
color: var(--_no-fc);

border-style: solid;
font-size: var(--fs-body1);
}

.s-notice {
.construct-notice-component(s-notice);

border-radius: var(--br-md);
border-width: var(--su-static1);
padding: var(--su16);
display: flex;
align-items: center;
gap: var(--su4);

&--icon {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced the s-notice--icon class for the icons

background: var(--_no-icon-bg);
border: var(--su1) solid var(--_no-icon-bc, var(--_no-icon-bg));
min-height: calc(var(--su32) + var(--su4)); //36px
height: 100%;
width: calc(var(--su32) + var(--su4)); //36px
padding: var(--su8);
margin-right: var(--su8);

//Center the svg icon
display: flex;
align-items: center;
}
}
3 changes: 0 additions & 3 deletions packages/stacks-classic/lib/components/toast/toast.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
.s-notice {
box-shadow: var(--bs-sm);
max-width: 44rem;
padding-bottom: var(--su8);
padding-top: var(--su8);
pointer-events: all;
width: 100%;
}

display: flex;
Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading