From 54760de3c86f0fd09eead5f189795c7496ee31bb Mon Sep 17 00:00:00 2001 From: Guy Willis Date: Mon, 16 Sep 2024 12:15:13 +0100 Subject: [PATCH 1/3] Add support for vertical accordion items and custom title icons --- .../adapt-contrib-accordion/accordion.less | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/less/plugins/adapt-contrib-accordion/accordion.less b/less/plugins/adapt-contrib-accordion/accordion.less index 0b981973..4124ac50 100644 --- a/less/plugins/adapt-contrib-accordion/accordion.less +++ b/less/plugins/adapt-contrib-accordion/accordion.less @@ -5,7 +5,8 @@ position: relative; padding-top: @item-padding; padding-bottom: @item-padding; - padding-inline: @item-padding (@icon-size + (@item-padding * 2)); + padding-inline-start: @item-padding; + padding-inline-end: @icon-size + (@item-padding * 2); text-align: start; background-color: @item-color; color: @item-color-inverted; @@ -18,6 +19,10 @@ } } + &__btn.has-title-icon { + padding-inline-start: @icon-size + (@item-padding * 2); + } + &__btn.is-visited { background-color: @visited; color: @visited-inverted; @@ -28,7 +33,20 @@ color: @item-color-inverted-selected; } - &__icon { + &:not(.is-vertical) &__title-icon { + position: absolute; + top: 50%; + left: @item-padding; + .transform(translateY(-50%)); + + .dir-rtl & { + left: inherit; + right: @item-padding; + } + + } + + &:not(.is-vertical) &__icon { position: absolute; top: 50%; right: @item-padding; @@ -52,4 +70,24 @@ &.has-img-zoom &__image-container { .img-zoom(); } + + // vertical items + &.is-vertical &__btn { + padding-inline: @item-padding; + text-align: center; + } + + &.is-vertical &__title-icon, + &.is-vertical &__title { + display: block; + padding-bottom: @icon-padding / 2; + } + + &.is-vertical &__icon { + display: block; + } + + &.is-vertical &__content { + text-align: center; + } } From 0375e2d5481545ab8780ea39e5aeaad87a0865cf Mon Sep 17 00:00:00 2001 From: Guy Willis Date: Mon, 16 Sep 2024 12:37:53 +0100 Subject: [PATCH 2/3] Moved structural vertical styles to plugin --- less/plugins/adapt-contrib-accordion/accordion.less | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/less/plugins/adapt-contrib-accordion/accordion.less b/less/plugins/adapt-contrib-accordion/accordion.less index 4124ac50..5dfcd234 100644 --- a/less/plugins/adapt-contrib-accordion/accordion.less +++ b/less/plugins/adapt-contrib-accordion/accordion.less @@ -43,7 +43,6 @@ left: inherit; right: @item-padding; } - } &:not(.is-vertical) &__icon { @@ -74,20 +73,10 @@ // vertical items &.is-vertical &__btn { padding-inline: @item-padding; - text-align: center; } &.is-vertical &__title-icon, &.is-vertical &__title { - display: block; padding-bottom: @icon-padding / 2; } - - &.is-vertical &__icon { - display: block; - } - - &.is-vertical &__content { - text-align: center; - } } From 318b9099f789f6d20b06ad72a15e058fabffafad Mon Sep 17 00:00:00 2001 From: Guy Willis Date: Mon, 16 Sep 2024 15:07:54 +0100 Subject: [PATCH 3/3] Updated class name --- less/plugins/adapt-contrib-accordion/accordion.less | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/less/plugins/adapt-contrib-accordion/accordion.less b/less/plugins/adapt-contrib-accordion/accordion.less index 5dfcd234..a5231606 100644 --- a/less/plugins/adapt-contrib-accordion/accordion.less +++ b/less/plugins/adapt-contrib-accordion/accordion.less @@ -33,7 +33,7 @@ color: @item-color-inverted-selected; } - &:not(.is-vertical) &__title-icon { + &:not(.is-center-aligned) &__title-icon { position: absolute; top: 50%; left: @item-padding; @@ -45,7 +45,7 @@ } } - &:not(.is-vertical) &__icon { + &:not(.is-center-aligned) &__icon { position: absolute; top: 50%; right: @item-padding; @@ -71,12 +71,12 @@ } // vertical items - &.is-vertical &__btn { + &.is-center-aligned &__btn { padding-inline: @item-padding; } - &.is-vertical &__title-icon, - &.is-vertical &__title { + &.is-center-aligned &__title-icon, + &.is-center-aligned &__title { padding-bottom: @icon-padding / 2; } }