mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
e342142b61
* 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>
135 lines
3.7 KiB
SCSS
135 lines
3.7 KiB
SCSS
//
|
|
// 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: var(--#{$prefix}accordion-btn-padding-y) var(--#{$prefix}accordion-btn-padding-x);
|
|
@include font-size($font-size-base);
|
|
color: var(--#{$prefix}accordion-color);
|
|
text-align: left; // Reset button style
|
|
background-color: $accordion-button-bg;
|
|
border: 0;
|
|
@include border-radius(0);
|
|
overflow-anchor: none;
|
|
@include transition($accordion-transition);
|
|
|
|
&:not(.collapsed) {
|
|
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);
|
|
transform: $accordion-icon-transform;
|
|
}
|
|
}
|
|
|
|
// Accordion icon
|
|
&::after {
|
|
flex-shrink: 0;
|
|
width: $accordion-icon-width;
|
|
height: $accordion-icon-width;
|
|
margin-left: auto;
|
|
content: "";
|
|
background-image: escape-svg($accordion-button-icon);
|
|
background-repeat: no-repeat;
|
|
background-size: $accordion-icon-width;
|
|
@include transition($accordion-icon-transition);
|
|
}
|
|
|
|
&:hover {
|
|
z-index: 2;
|
|
}
|
|
|
|
&:focus {
|
|
z-index: 3;
|
|
border-color: $accordion-button-focus-border-color;
|
|
outline: 0;
|
|
box-shadow: $accordion-button-focus-box-shadow;
|
|
}
|
|
}
|
|
|
|
.accordion-header {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.accordion-item {
|
|
color: color-contrast($accordion-bg);
|
|
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(var(--#{$prefix}accordion-border-radius));
|
|
|
|
.accordion-button {
|
|
@include border-top-radius($accordion-inner-border-radius); // todo
|
|
}
|
|
}
|
|
|
|
&:not(:first-of-type) {
|
|
border-top: 0;
|
|
}
|
|
|
|
// Only set a border-radius on the last item if the accordion is collapsed
|
|
&:last-of-type {
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
|
|
|
.accordion-button {
|
|
&.collapsed {
|
|
@include border-bottom-radius($accordion-inner-border-radius); // todo
|
|
}
|
|
}
|
|
|
|
.accordion-collapse {
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
|
}
|
|
}
|
|
}
|
|
|
|
.accordion-body {
|
|
padding: var(--#{$prefix}accordion-body-padding-y) var(--#{$prefix}accordion-body-padding-x);
|
|
}
|
|
|
|
|
|
// Flush accordion items
|
|
//
|
|
// Remove borders and border-radius to keep accordion items edge-to-edge.
|
|
|
|
.accordion-flush {
|
|
.accordion-collapse {
|
|
border-width: 0;
|
|
}
|
|
|
|
.accordion-item {
|
|
border-right: 0;
|
|
border-left: 0;
|
|
@include border-radius(0);
|
|
|
|
&:first-child { border-top: 0; }
|
|
&:last-child { border-bottom: 0; }
|
|
|
|
.accordion-button {
|
|
@include border-radius(0);
|
|
}
|
|
}
|
|
}
|