mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-31 00:59:51 +02:00
Train PR: CSS variables for accordion, cards, navs, and modals (#36071)
* Convert accordion to CSS vars * Update accordion.md * Convert navs to CSS variables * Split up CSS vars * bundlewatch * fix vars * Convert cards to CSS vars * Convert modals to CSS variables * Bundlewatch Co-authored-by: Geremia Taglialatela <tagliala.dev@gmail.com>
This commit is contained in:
@@ -2,14 +2,30 @@
|
||||
// Base styles
|
||||
//
|
||||
|
||||
.accordion {
|
||||
// scss-docs-start accordion-css-vars
|
||||
--#{$prefix}accordion-color: #{$accordion-color};
|
||||
--#{$prefix}accordion-bg: #{$accordion-bg};
|
||||
--#{$prefix}accordion-border-color: #{$accordion-border-color};
|
||||
--#{$prefix}accordion-border-width: #{$accordion-border-width};
|
||||
--#{$prefix}accordion-border-radius: #{$accordion-border-radius};
|
||||
--#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x};
|
||||
--#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y};
|
||||
--#{$prefix}accordion-body-padding-x: #{$accordion-body-padding-x};
|
||||
--#{$prefix}accordion-body-padding-y: #{$accordion-body-padding-y};
|
||||
--#{$prefix}accordion-active-color: #{$accordion-button-active-color};
|
||||
--#{$prefix}accordion-active-bg: #{$accordion-button-active-bg};
|
||||
// scss-docs-end accordion-css-vars
|
||||
}
|
||||
|
||||
.accordion-button {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: $accordion-button-padding-y $accordion-button-padding-x;
|
||||
padding: var(--#{$prefix}accordion-btn-padding-y) var(--#{$prefix}accordion-btn-padding-x);
|
||||
@include font-size($font-size-base);
|
||||
color: $accordion-button-color;
|
||||
color: var(--#{$prefix}accordion-color);
|
||||
text-align: left; // Reset button style
|
||||
background-color: $accordion-button-bg;
|
||||
border: 0;
|
||||
@@ -18,9 +34,9 @@
|
||||
@include transition($accordion-transition);
|
||||
|
||||
&:not(.collapsed) {
|
||||
color: $accordion-button-active-color;
|
||||
background-color: $accordion-button-active-bg;
|
||||
box-shadow: inset 0 calc($accordion-border-width * -1) 0 $accordion-border-color; // stylelint-disable-line function-disallowed-list
|
||||
color: var(--#{$prefix}accordion-active-color);
|
||||
background-color: var(--#{$prefix}accordion-active-bg);
|
||||
box-shadow: inset 0 calc(var(--#{$prefix}accordion-border-width) * -1) 0 var(--#{$prefix}accordion-border-color); // stylelint-disable-line function-disallowed-list
|
||||
|
||||
&::after {
|
||||
background-image: escape-svg($accordion-button-active-icon);
|
||||
@@ -59,14 +75,14 @@
|
||||
|
||||
.accordion-item {
|
||||
color: color-contrast($accordion-bg);
|
||||
background-color: $accordion-bg;
|
||||
border: $accordion-border-width solid $accordion-border-color;
|
||||
background-color: var(--#{$prefix}accordion-bg);
|
||||
border: var(--#{$prefix}accordion-border-width) solid var(--#{$prefix}accordion-border-color);
|
||||
|
||||
&:first-of-type {
|
||||
@include border-top-radius($accordion-border-radius);
|
||||
@include border-top-radius(var(--#{$prefix}accordion-border-radius));
|
||||
|
||||
.accordion-button {
|
||||
@include border-top-radius($accordion-inner-border-radius);
|
||||
@include border-top-radius($accordion-inner-border-radius); // todo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,22 +92,22 @@
|
||||
|
||||
// Only set a border-radius on the last item if the accordion is collapsed
|
||||
&:last-of-type {
|
||||
@include border-bottom-radius($accordion-border-radius);
|
||||
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
||||
|
||||
.accordion-button {
|
||||
&.collapsed {
|
||||
@include border-bottom-radius($accordion-inner-border-radius);
|
||||
@include border-bottom-radius($accordion-inner-border-radius); // todo
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-collapse {
|
||||
@include border-bottom-radius($accordion-border-radius);
|
||||
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: $accordion-body-padding-y $accordion-body-padding-x;
|
||||
padding: var(--#{$prefix}accordion-body-padding-y) var(--#{$prefix}accordion-body-padding-x);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user