From 41f92c31e2c4790d5d3bb92d7262902b6f7ad3f8 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 31 Mar 2025 08:10:02 +0200 Subject: More options for l-button-group --- src/layouts/_button-group.scss | 37 +++++++++++++++++++++++++++++++++++-- src/layouts/_button-group.vars.scss | 14 +++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/layouts/_button-group.scss b/src/layouts/_button-group.scss index c51ae7e..25bc2fe 100644 --- a/src/layouts/_button-group.scss +++ b/src/layouts/_button-group.scss @@ -5,13 +5,46 @@ @forward 'button-group.vars'; @use 'button-group.vars' as vars; +@use '../objects/action-button.vars' as action-button; @mixin styles { @include materialize-at-root(meta.module-variables('vars')); @include bem.layout('button-group') { - display: flex; + display: inline-flex; flex-wrap: wrap; - gap: props.get(vars.$spacing); + gap: props.get(vars.$gap); + + @each $mod, $size in vars.$sizes { + @include bem.modifier($mod) { + gap: props.get($size); + } + } + + @include bem.modifier('align-block') { + margin-inline: calc(-1 * props.get(action-button.$pad-i) - props.get(action-button.$border-width)); + + @include bem.modifier('pill') { + margin-inline: calc(-1 * props.get(action-button.$pad-i-pill) - props.get(action-button.$border-width)); + } + + @include bem.modifier('icon') { + margin-inline: calc(-1 * props.get(action-button.$pad-b) - props.get(action-button.$border-width) - .5em * (props.get(action-button.$line-height) - 1)); + } + + @each $mod, $pad-i, $pad-i-label, $pad-i-pill, $pad-b, $font-size in action-button.$fixed-sizes { + @include bem.modifier($mod) { + margin-inline: calc(-1 * props.get($pad-i) - props.get(action-button.$border-width)); + + @include bem.modifier('pill') { + margin-inline: calc(-1 * props.get($pad-i-pill) - props.get(action-button.$border-width)); + } + + @include bem.modifier('icon') { + margin-inline: calc(-1 * props.get($pad-b) - props.get(action-button.$border-width) - .5em * (props.get(action-button.$line-height) - 1)); + } + } + } + } } } diff --git a/src/layouts/_button-group.vars.scss b/src/layouts/_button-group.vars.scss index 95ac8f8..50c1b53 100644 --- a/src/layouts/_button-group.vars.scss +++ b/src/layouts/_button-group.vars.scss @@ -1,4 +1,16 @@ @use 'iro-sass/src/props'; @use '../core.vars' as core; -$spacing: props.def(--l-button-group--spacing, props.get(core.$size--150)) !default; +$gap: props.def(--l-button-group--gap, props.get(core.$size--150)) !default; + +$gapless: props.def(--l-button-group--gapless, 0) !default; +$sm: props.def(--l-button-group--sm, props.get(core.$size--100)) !default; +$lg: props.def(--l-button-group--lg, props.get(core.$size--300)) !default; +$xl: props.def(--l-button-group--xl, props.get(core.$size--450)) !default; + +$sizes: ( + 'gapless': $gapless, + 'sm': $sm, + 'lg': $lg, + 'xl': $xl, +) !default; -- cgit v1.2.3-70-g09d2