From 4c1f807142d4ddd6b63ea56b148ec20a5ae194bc Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Thu, 5 Nov 2020 21:18:38 +0100 Subject: [PATCH] Fix missing border & add transitions --- scss/_accordion.scss | 63 +++++++++---------- scss/_variables.scss | 4 ++ site/content/docs/5.0/components/accordion.md | 12 ++-- 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/scss/_accordion.scss b/scss/_accordion.scss index 479aad1cc5..a68aaa70e3 100644 --- a/scss/_accordion.scss +++ b/scss/_accordion.scss @@ -11,10 +11,14 @@ @include font-size($font-size-base); color: $accordion-button-color; background-color: $accordion-button-bg; - border: solid $accordion-border-color; - border-width: $accordion-border-width $accordion-border-width 0; + border: $accordion-border-width solid $accordion-border-color; @include border-radius(0); overflow-anchor: none; + @include transition($accordion-transition); + + &.collapsed { + border-bottom-width: 0; + } &:not(.collapsed) { color: $accordion-button-active-color; @@ -45,8 +49,9 @@ &:focus { z-index: 3; + border-color: $accordion-button-focus-border-color; outline: 0; - box-shadow: $btn-focus-box-shadow; + box-shadow: $accordion-button-focus-box-shadow; } } @@ -55,35 +60,35 @@ } .accordion-item { - @include border-radius($accordion-border-radius); - - &:last-of-type { - .accordion-button { - border-bottom-width: $accordion-border-width; - - // Only set a border-radius on the last item if the accordion is collapsed - &.collapsed { - @include border-bottom-radius($accordion-border-radius); - } - } - - .accordion-body { - border-width: 0 $accordion-border-width $accordion-border-width; - @include border-bottom-radius($accordion-border-radius); - } - } - &:first-of-type { .accordion-button { @include border-top-radius($accordion-border-radius); } } + + &:last-of-type { + .accordion-button { + // Only set a border-radius on the last item if the accordion is collapsed + &.collapsed { + border-bottom-width: $accordion-border-width; + @include border-bottom-radius($accordion-border-radius); + } + } + + .accordion-collapse { + border-bottom-width: $accordion-border-width; + @include border-bottom-radius($accordion-border-radius); + } + } +} + +.accordion-collapse { + border: solid $accordion-border-color; + border-width: 0 $accordion-border-width; } .accordion-body { padding: $accordion-body-padding-y $accordion-body-padding-x; - border: solid $accordion-border-color; - border-width: $accordion-border-width $accordion-border-width 0; } @@ -98,15 +103,11 @@ @include border-radius(0); } - .accordion-body { + .accordion-collapse { border-width: 0; } .accordion-item { - border-right-width: 0; - border-left-width: 0; - @include border-radius(0); - &:first-of-type { .accordion-button { border-top-width: 0; @@ -115,14 +116,10 @@ } &:last-of-type { - .accordion-button { + .accordion-button.collapsed { border-bottom-width: 0; @include border-bottom-radius(0); } - - .accordion-body { - border-width: 0; - } } } } diff --git a/scss/_variables.scss b/scss/_variables.scss index 6c5a070f26..7773ebaf16 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -1030,9 +1030,13 @@ $accordion-button-padding-y: $accordion-padding-y !default; $accordion-button-padding-x: $accordion-padding-x !default; $accordion-button-color: $accordion-color !default; $accordion-button-bg: $accordion-bg !default; +$accordion-transition: $btn-transition, border-radius .15s ease !default; $accordion-button-active-bg: tint-color($component-active-bg, 90%) !default; $accordion-button-active-color: $primary !default; +$accordion-button-focus-border-color: $input-focus-border-color !default; +$accordion-button-focus-box-shadow: $btn-focus-box-shadow !default; + $accordion-icon-width: 1.25rem !default; $accordion-icon-color: $accordion-color !default; $accordion-icon-active-color: $accordion-button-active-color !default; diff --git a/site/content/docs/5.0/components/accordion.md b/site/content/docs/5.0/components/accordion.md index 9844cf868c..1f08a79115 100644 --- a/site/content/docs/5.0/components/accordion.md +++ b/site/content/docs/5.0/components/accordion.md @@ -29,7 +29,7 @@ Click the accordions below to expand/collapse the accordion content. Accordion Item #1 -
+
This is the first item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -41,7 +41,7 @@ Click the accordions below to expand/collapse the accordion content. Accordion Item #2 -
+
This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -53,7 +53,7 @@ Click the accordions below to expand/collapse the accordion content. Accordion Item #3 -
+
This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -74,7 +74,7 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a Accordion Item #1 -
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
@@ -84,7 +84,7 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a Accordion Item #2 -
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
@@ -94,7 +94,7 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a Accordion Item #3 -
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.