Skip to content

Commit

Permalink
fix(notification): change box-shadow to border (#4299)
Browse files Browse the repository at this point in the history
This change also makes inline notification's text color non-themeable
for now, given the background color is non-themeable and making it
themeable requires themeable component-specific token (or new global
theme tokens).

This stop-gap approach may be enough for short team because IIRC
low-contrast notifications is there for a backword-compatibility
reason.
  • Loading branch information
asudoh authored Oct 22, 2019
1 parent 1afc402 commit 150cd2b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

display: flex;
justify-content: space-between;
position: relative;
height: auto;
min-height: rem(48px);
min-width: rem(288px);
Expand All @@ -48,8 +49,21 @@
}

.#{$prefix}--inline-notification--low-contrast {
color: $text-01;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
// Stop-gap to ensure color contrast (vs. fixed background color) until we have component-specific theme tokens
color: map-get($carbon--theme--white, 'text-01');

&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
filter: opacity(0.4);
border-style: solid;
border-width: 1px 1px 1px 0;
}
}

.#{$prefix}--inline-notification--error {
Expand All @@ -61,6 +75,10 @@
$support-01,
$notification-error-background-color
);

&:before {
border-color: $support-01;
}
}

.#{$prefix}--inline-notification--success {
Expand All @@ -72,6 +90,10 @@
$support-02,
$notification-success-background-color
);

&:before {
border-color: $support-02;
}
}

.#{$prefix}--inline-notification--info {
Expand All @@ -83,6 +105,10 @@
$support-04,
$notification-info-background-color
);

&:before {
border-color: $support-04;
}
}

.#{$prefix}--inline-notification--info .bx--inline-notification__icon {
Expand All @@ -98,6 +124,10 @@
$support-03,
$notification-warning-background-color
);

&:before {
border-color: $support-03;
}
}

.#{$prefix}--inline-notification--warning
Expand Down Expand Up @@ -179,11 +209,11 @@
.#{$prefix}--inline-notification--low-contrast {
.#{$prefix}--inline-notification__close-button
.#{$prefix}--inline-notification__close-icon {
fill: $ui-05;
fill: map-get($carbon--theme--white, 'text-01');
}

.#{$prefix}--inline-notification__action-button {
color: $link-01;
color: $carbon--blue-60;

&:active {
color: $carbon--blue-80;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
}

.#{$prefix}--toast-notification--low-contrast {
color: $text-01;
// Stop-gap to ensure color contrast (vs. fixed background color) until we have component-specific theme tokens
color: map-get($carbon--theme--white, 'text-01');
}

.#{$prefix}--toast-notification--error {
Expand Down Expand Up @@ -135,7 +136,7 @@
.#{$prefix}--toast-notification--low-contrast
.#{$prefix}--toast-notification__close-button
.#{$prefix}--toast-notification__close-icon {
fill: $ui-05;
fill: map-get($carbon--theme--white, 'text-01');
}

.#{$prefix}--toast-notification__title {
Expand All @@ -157,7 +158,8 @@

.#{$prefix}--toast-notification--low-contrast
.#{$prefix}--toast-notification__subtitle {
color: $text-01;
// Stop-gap to ensure color contrast (vs. fixed background color) until we have component-specific theme tokens
color: map-get($carbon--theme--white, 'text-01');
}

.#{$prefix}--toast-notification__caption {
Expand All @@ -169,7 +171,8 @@

.#{$prefix}--toast-notification--low-contrast
.#{$prefix}--toast-notification__caption {
color: $text-01;
// Stop-gap to ensure color contrast (vs. fixed background color) until we have component-specific theme tokens
color: map-get($carbon--theme--white, 'text-01');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<p class="{{@root.prefix}}--{{../variant}}-notification__caption">{{timestamp}}</p>
{{/is}}
</div>
{{#is ../variant "inline"}}
<button tabindex="0" class="{{@root.prefix}}--inline-notification__action-button {{@root.prefix}}--btn {{@root.prefix}}--btn--sm {{@root.prefix}}--btn--ghost" type="button">Action</button>
{{/is}}
<button data-notification-btn class="{{@root.prefix}}--{{../variant}}-notification__close-button" type="button" aria-label="close">
{{ carbon-icon 'Close16' class=(add @root.prefix (add '--' (add ../variant '-notification__close-icon'))) }}
</button>
Expand Down

0 comments on commit 150cd2b

Please sign in to comment.