mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-19 11:51:23 +02:00
Convert alerts to CSS variables (#35401)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -3,11 +3,22 @@
|
||||
//
|
||||
|
||||
.alert {
|
||||
// scss-docs-start alert-css-vars
|
||||
--#{$variable-prefix}alert-bg: transparent;
|
||||
--#{$variable-prefix}alert-padding: #{$alert-padding-y $alert-padding-x};
|
||||
--#{$variable-prefix}alert-margin-bottom: #{$alert-margin-bottom};
|
||||
--#{$variable-prefix}alert-color: #{$alert-padding-y $alert-padding-x};
|
||||
--#{$variable-prefix}alert-border-color: transparent;
|
||||
--#{$variable-prefix}alert-border: #{$alert-border-width} solid var(--#{$variable-prefix}alert-border-color);
|
||||
--#{$variable-prefix}alert-border-radius: #{$alert-border-radius};
|
||||
// scss-docs-end alert-css-vars
|
||||
|
||||
position: relative;
|
||||
padding: $alert-padding-y $alert-padding-x;
|
||||
margin-bottom: $alert-margin-bottom;
|
||||
border: $alert-border-width solid transparent;
|
||||
@include border-radius($alert-border-radius);
|
||||
padding: var(--#{$variable-prefix}alert-padding);
|
||||
margin-bottom: var(--#{$variable-prefix}alert-margin-bottom);
|
||||
background-color: var(--#{$variable-prefix}alert-bg);
|
||||
border: var(--#{$variable-prefix}alert-border);
|
||||
border-radius: var(--#{$variable-prefix}alert-border-radius, 0); // stylelint-disable-line property-disallowed-list
|
||||
}
|
||||
|
||||
// Headings for larger alerts
|
||||
@@ -47,6 +58,7 @@
|
||||
$alert-background: shift-color($value, $alert-bg-scale);
|
||||
$alert-border: shift-color($value, $alert-border-scale);
|
||||
$alert-color: shift-color($value, $alert-color-scale);
|
||||
|
||||
@if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) {
|
||||
$alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale));
|
||||
}
|
||||
|
@@ -1,8 +1,12 @@
|
||||
// scss-docs-start alert-variant-mixin
|
||||
@mixin alert-variant($background, $border, $color) {
|
||||
color: $color;
|
||||
@include gradient-bg($background);
|
||||
border-color: $border;
|
||||
--#{$variable-prefix}alert-color: #{$color};
|
||||
--#{$variable-prefix}alert-bg: #{$background};
|
||||
--#{$variable-prefix}alert-border-color: #{$border};
|
||||
|
||||
@if $enable-gradients {
|
||||
background-image: var(--#{$variable-prefix}gradient);
|
||||
}
|
||||
|
||||
.alert-link {
|
||||
color: shade-color($color, 20%);
|
||||
|
Reference in New Issue
Block a user