Skip to content

Commit

Permalink
refactor(mixins/toast): add new mixin toast-class-variant to have b…
Browse files Browse the repository at this point in the history
…ackward compatibility.
  • Loading branch information
sciborrudnicki committed Jul 15, 2022
1 parent 0fb4a68 commit 87ebe64
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/mixins/_toast.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
@use '../functions/color' as *;

// Toast variant mixin
/*
The mixin includes toast `background` and `border` of a given `$color`.
*/
// @mixin toast-variant($color: $dark-color) { // old spectre.css
@mixin toast-variant($name: 'dark', $color: 'dark-color') {
@mixin toast-variant($color: 'dark-color') {
// background: rgba($color, .95); // old spectre.css
background: color($color, $alpha: 0.95);
// border-color: $color; // old spectre.css
border-color: color($color);
}

/*
The mixin includes an extension class of name prefixed with `toast-` with a given color name that includes a toast variant of the given `$color`.
*/
@mixin toast-class-variant($name: 'dark', $color: 'dark-color') {
&.toast-#{$name} {
// background: rgba($color, .95); // old spectre.css
background: color($color, $alpha: 0.95);
// border-color: $color; // old spectre.css
border-color: color($color);
@include toast-variant($color);
}
}

0 comments on commit 87ebe64

Please sign in to comment.