Skip to content
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

[wip] Banner and Notification components update #735

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/five-ties-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@microsoft/atlas-site': minor
---

Updating banner and notification components documentation and creating pattern pages for them.
5 changes: 5 additions & 0 deletions .changeset/funny-seahorses-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@microsoft/atlas-css': major
---

Updating banner and notification components.
5 changes: 5 additions & 0 deletions .changeset/wild-pants-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@microsoft/atlas-css': patch
---

Refactoring .buttons
79 changes: 60 additions & 19 deletions css/src/components/banner.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,66 @@
$banner-background: $info-background !default;
$banner-padding: $spacer-5 !default;
$banner-background: $secondary-background !default;
$banner-padding-block: 0.75em !default;

$banner-font-size: $font-size-7 !default;
$banner-color: $info-dark !default;
$banner-gap: $spacer-3 !default;
$banner-icon-block-spacing: 0.2em !default;

$banner-border-color: $border-white-high-contrast !default;
$banner-border-width: $border-width !default;
$banner-color: $text !default;
$banner-font-size: $font-size-8 !default;

$banner-button-font-size: $font-size-9 !default;

$banner-dismiss-margin: $spacer-2 !default;
$banner-border-color: $control-border !default;
$banner-border-width: $border-width !default;

.banner {
@extend %layout-gap;

display: grid;
position: relative;
grid-template: auto / 1fr auto;
grid-template-areas: 'banner-content dismiss';
align-items: flex-start;
outline-color: $text;
background-color: $banner-background;
color: $banner-color;
font-size: $banner-font-size;
line-height: $line-height-normal;
padding-block: $banner-padding;
grid-template: auto / auto 1fr auto;
grid-template-areas: 'icon banner-content dismiss';
padding-block: $banner-padding-block;
word-wrap: break-word;
word-break: break-word;
border-block: $banner-border-width solid $banner-border-color;

@each $name, $color-set in $colors {
$base: nth($color-set, $color-index-base);
$dark: nth($color-set, $color-index-dark);
$background: nth($color-set, $color-index-background);

&.banner-#{$name} {
border-color: $dark;
background-color: $background;

&.is-loading::before {
border-color: transparent transparent $dark $dark;
}

.banner-icon {
color: $dark;
}
}
}

&.is-loading {
color: transparent;

> :first-child {
margin-inline-start: calc($banner-padding + 0.375em);
margin-inline-start: 1.75em;
}

&::before {
@include loader;

position: absolute;
inset-block-start: $banner-padding;
inset-block-start: $banner-padding-block;
inset-inline-start: $layout-gap;
border-color: transparent transparent $banner-color $banner-color;

Expand All @@ -50,25 +73,43 @@ $banner-dismiss-margin: $spacer-2 !default;
.banner-content {
grid-area: banner-content;

a:not(.button) {
color: currentColor;
.banner-title {
font-weight: $weight-semibold;
text-decoration: underline;
margin-inline-end: $banner-gap;
}

.theme-high-contrast & {
color: $hyperlink;
}
a:not(.button) {
text-decoration: underline;

&:hover {
text-decoration-thickness: 0.15em;
}
}

.button {
font-size: $banner-button-font-size;
}

p {
max-width: $reading-max-width;
}
}

.banner-icon {
grid-area: icon;
flex-shrink: 0;
margin-inline-end: $banner-gap;
}

.banner-dismiss {
@include dismiss-square;

grid-area: dismiss;
margin-inline-start: $banner-dismiss-margin;
margin-inline-start: $banner-gap;
}

.banner-icon,
.banner-dismiss {
margin-block-start: $banner-icon-block-spacing;
}
}
25 changes: 1 addition & 24 deletions css/src/components/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
gap: 0.5rem;

&.buttons-centered {
justify-content: center;
Expand All @@ -14,30 +15,6 @@
justify-content: flex-end;
}

.button {
margin-block-end: 0.5rem;
margin-inline-end: 0.5rem;

&:only-child,
&.is-fullwidth,
&.is-full-width {
margin-inline-end: 0;
}

&.is-full-width-mobile,
&.is-fullwidth-mobile {
margin-inline-end: 0;

@include tablet {
margin-inline-end: 0.5rem;
}
}
}

&:last-child {
margin-block-end: -0.5rem;
}

&:not(:last-child) {
margin-block-end: 1rem;
}
Expand Down
70 changes: 36 additions & 34 deletions css/src/components/notification.scss
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
$notification-background: $secondary-background !default;
$notification-padding: $spacer-5 !default;
$notification-padding-block: 0.75em !default;
$notification-padding-inline: 0.85em !default;

$notification-gap: $spacer-3 !default;
$notification-icon-block-spacing: 0.2em !default;

$notification-font-size: $font-size-7 !default;
$notification-color: $text !default;
$notification-font-size: $font-size-8 !default;

$notification-button-font-size: $font-size-9 !default;

$notification-border-color: $control-border !default;
$notification-border-width: $border-width !default;
$notification-border-radius: $border-radius !default;

$notification-icon-inline-spacing: 0.375em !default;
$notification-icon-block-spacing: 0.2em !default;

$notification-dismiss-margin: $spacer-2 !default;

.notification {
display: grid;
position: relative;
padding: $notification-padding;
grid-template: auto / 1fr auto;
grid-template-areas: 'notification-content dismiss';
align-items: flex-start;
border: $notification-border-width solid $notification-border-color;
border-radius: $notification-border-radius;
outline-color: $text;
background-color: $notification-background;
color: $notification-color;
font-size: $notification-font-size;
line-height: $line-height-normal;
padding-inline: $notification-padding-inline;
padding-block: $notification-padding-block;
grid-template: auto / auto 1fr auto;
grid-template-areas: 'icon notification-content dismiss';
word-wrap: break-word;
word-break: break-word;

Expand All @@ -37,71 +40,70 @@ $notification-dismiss-margin: $spacer-2 !default;
&.notification-#{$name} {
border-color: $dark;
background-color: $background;
color: $dark;

&.is-loading::before {
border-color: transparent transparent $dark $dark;
}

.notification-icon {
color: $dark;
}
}
}

&.is-loading {
color: transparent;

> :first-child {
margin-inline-start: calc($notification-padding + 0.375em);
margin-inline-start: 1.75em;
}

&::before {
@include loader;

position: absolute;
inset-block-start: $notification-padding;
inset-inline-start: $notification-padding;
inset-block-start: $notification-padding-block;
inset-inline-start: $notification-padding-inline;
border-color: transparent transparent $notification-color $notification-color;
}
}

.notification-content {
grid-area: notification-content;

.notification-title,
a:not(.button) {
color: currentColor;
.notification-title {
font-weight: $weight-semibold;
margin-inline-end: $notification-gap;
}

a:not(.button) {
text-decoration: underline;

.theme-high-contrast & {
color: $hyperlink;
}

&:hover {
text-decoration-thickness: 0.15em;
}
}

.notification-title {
display: flex;
align-items: center;
justify-content: flex-start;
margin-block-end: $layout-1;

.icon {
flex-shrink: 0;
align-self: start;
margin-inline-end: $notification-icon-inline-spacing;
margin-block-start: $notification-icon-block-spacing;
}
.button {
font-size: $notification-button-font-size;
}
}

.notification-icon {
grid-area: icon;
flex-shrink: 0;
margin-inline-end: $notification-gap;
}

.notification-dismiss {
@include dismiss-square;

grid-area: dismiss;
margin-inline-start: $notification-dismiss-margin;
margin-inline-start: $notification-gap;
}

.notification-icon,
.notification-dismiss {
margin-block-start: $notification-icon-block-spacing;
}
}
2 changes: 2 additions & 0 deletions integration/tests/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const pathnames = [
'/patterns/article-header.html',
'/patterns/chat.html',
'/patterns/thread-history.html',
'/patterns/banner.html',
'/patterns/notification.html',
'/tokens/overview.html',
'/tokens/animation.html',
'/tokens/border.html',
Expand Down
Loading
Loading