-
+
- {% endfor %} diff --git a/Components/AccordionDefault/script.js b/Components/AccordionDefault/script.js index a603e1f0b..d4861a599 100644 --- a/Components/AccordionDefault/script.js +++ b/Components/AccordionDefault/script.js @@ -4,26 +4,21 @@ class AccordionDefault extends window.HTMLDivElement { constructor (self) { self = super(self) self.$ = $(self) - self.resolveElements() return self } - resolveElements () { - this.$accordionTriggers = $('[aria-controls]', this) - } - connectedCallback () { - this.$.on('click', this.$accordionTriggers.selector, this.togglePanel) + this.$.on('click', '[aria-controls]', this.togglePanel) } togglePanel () { - let $this = $(this) - if ($this.attr('aria-expanded') === 'true') { - $this.attr('aria-expanded', 'false') - $this.next().attr('aria-hidden', 'true').slideUp() + const $panel = $(this) + if ($panel.attr('aria-expanded') === 'true') { + $panel.attr('aria-expanded', 'false') + $panel.next().attr('aria-hidden', 'true').slideUp() } else { - $this.attr('aria-expanded', 'true') - $this.next().attr('aria-hidden', 'false').slideDown() + $panel.attr('aria-expanded', 'true') + $panel.next().attr('aria-hidden', 'false').slideDown() } } } diff --git a/Components/AccordionDefault/style.scss b/Components/AccordionDefault/style.scss index bd4b69a4a..350256c9c 100644 --- a/Components/AccordionDefault/style.scss +++ b/Components/AccordionDefault/style.scss @@ -30,35 +30,41 @@ padding: 15px 30px 15px 0; position: relative; width: 100%; - } - &-arrow { - $colorTextRgb: red($color-contrast), green($color-contrast), blue($color-contrast); + &::after { + $colorTextRgb: red($color-contrast), green($color-contrast), blue($color-contrast); - background-image: url("data:image/svg+xml;utf8,"); - background-position: center center; - background-repeat: no-repeat; - background-size: 100%; - display: block; - height: 20px; - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); - transition: transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1); - width: 30px; - } - } + background-image: url("data:image/svg+xml;utf8,"); + background-position: center; + background-repeat: no-repeat; + background-size: 100%; + content: ''; + display: block; + height: 100%; + position: absolute; + right: 0; + top: 0; + transition: transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1); + width: 30px; + } - [aria-expanded="true"] { - .panel-arrow { - transform: translateY(-50%) rotateX(180deg); + &[aria-expanded="true"] { + &::after { + transform: rotateX(180deg); + } + } } - } - .panel-content { - @include resetContentMargins; + // do not add margins or padding to this, it will break the layout + &-content { + display: none; + margin: 0; + padding: 0; + } - display: none; + // add custom paddings here + &-inner { + padding: 0; + } } }
-
{% for panel in accordionPanels %}