From b3d15e0a176fe28dca866f43e68432dea79eb889 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 12 Nov 2024 15:48:28 +0100 Subject: Consistent button paddings --- src/objects/_action-button.scss | 12 ++++++++++-- src/objects/_action-button.vars.scss | 34 +++++++++++++++++++--------------- src/objects/_button.vars.scss | 2 +- tpl/objects/action-button.pug | 7 ++++++- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss index ca047bc..dcabb57 100644 --- a/src/objects/_action-button.scss +++ b/src/objects/_action-button.scss @@ -137,6 +137,10 @@ } } + @include bem.elem('label') { + margin-inline: props.get(vars.$pad-i-label); + } + @include -apply-theme(vars.$default-theme); @each $theme in map.keys(props.get(vars.$themes)) { @@ -154,12 +158,16 @@ } } - @each $mod, $pad-i, $pad-i-pill, $pad-b, $font-size in vars.$fixed-sizes { + @each $mod, $pad-i, $pad-i-label, $pad-i-pill, $pad-b, $font-size in vars.$fixed-sizes { @include bem.modifier($mod) { padding-block: props.get($pad-b); padding-inline: props.get($pad-i); font-size: props.get($font-size); + @include bem.elem('label') { + margin-inline: props.get($pad-i-label); + } + @include bem.modifier('pill') { padding-inline: props.get($pad-i-pill); } @@ -170,7 +178,7 @@ inline-size: calc(1em * props.get(vars.$line-height) + 2 * props.get(vars.$pad-b)); padding-inline: 0; - @each $mod, $pad-i, $pad-i-pill, $pad-b, $font-size in vars.$fixed-sizes { + @each $mod, $pad-i, $pad-i-label, $pad-i-pill, $pad-b, $font-size in vars.$fixed-sizes { @include bem.modifier($mod) { inline-size: calc(1em * props.get(vars.$line-height) + 2 * props.get($pad-b)); padding-inline: 0; diff --git a/src/objects/_action-button.vars.scss b/src/objects/_action-button.vars.scss index 9afd5d7..421ccb2 100644 --- a/src/objects/_action-button.vars.scss +++ b/src/objects/_action-button.vars.scss @@ -5,35 +5,39 @@ $line-height: props.def(--o-action-button--line-height, 1.4) !default; $pad-i: props.def(--o-action-button--pad-i, props.get(core.$size--150)) !default; +$pad-i-label: props.def(--o-button--pad-i-label, props.get(core.$size--50)) !default; $pad-i-pill: props.def(--o-action-button--pad-i-pill, props.get(core.$size--200)) !default; $pad-b: props.def(--o-action-button--pad-b, props.get(core.$size--85)) !default; $border-width: props.def(--o-action-button--border-width, props.get(core.$border-width--thin)) !default; $rounding: props.def(--o-action-button--rounding, props.get(core.$rounding)) !default; $font-size: props.def(--o-action-button--font-size, props.get(core.$font-size--100)) !default; -$pad-i--sm: props.def(--o-action-button--sm--pad-i, props.get(core.$size--100)) !default; -$pad-i-pill--sm: props.def(--o-action-button--sm--pad-i-pill, props.get(core.$size--150)) !default; -$pad-b--sm: props.def(--o-action-button--sm--pad-b, props.get(core.$size--40)) !default; -$font-size--sm: props.def(--o-action-button--sm--font-size, props.get(core.$font-size--75)) !default; +$pad-i--sm: props.def(--o-action-button--sm--pad-i, props.get(core.$size--100)) !default; +$pad-i-label--sm: props.def(--o-button--sm--pad-i-label, props.get(core.$size--25)) !default; +$pad-i-pill--sm: props.def(--o-action-button--sm--pad-i-pill, props.get(core.$size--150)) !default; +$pad-b--sm: props.def(--o-action-button--sm--pad-b, props.get(core.$size--40)) !default; +$font-size--sm: props.def(--o-action-button--sm--font-size, props.get(core.$font-size--75)) !default; -$pad-i--lg: props.def(--o-action-button--lg--pad-i, props.get(core.$size--175)) !default; -$pad-i-pill--lg: props.def(--o-action-button--lg--pad-i-pill, props.get(core.$size--225)) !default; -$pad-b--lg: props.def(--o-action-button--lg--pad-b, props.get(core.$size--115)) !default; -$font-size--lg: props.def(--o-action-button--lg--font-size, props.get(core.$font-size--150)) !default; +$pad-i--lg: props.def(--o-action-button--lg--pad-i, props.get(core.$size--175)) !default; +$pad-i-label--lg: props.def(--o-button--lg--pad-i-label, props.get(core.$size--100)) !default; +$pad-i-pill--lg: props.def(--o-action-button--lg--pad-i-pill, props.get(core.$size--250)) !default; +$pad-b--lg: props.def(--o-action-button--lg--pad-b, props.get(core.$size--115)) !default; +$font-size--lg: props.def(--o-action-button--lg--font-size, props.get(core.$font-size--150)) !default; -$pad-i--xl: props.def(--o-action-button--xl--pad-i, props.get(core.$size--225)) !default; -$pad-i-pill--xl: props.def(--o-action-button--xl--pad-i-pill, props.get(core.$size--300)) !default; -$pad-b--xl: props.def(--o-action-button--xl--pad-b, props.get(core.$size--150)) !default; -$font-size--xl: props.def(--o-action-button--xl--font-size, props.get(core.$font-size--200)) !default; +$pad-i--xl: props.def(--o-action-button--xl--pad-i, props.get(core.$size--225)) !default; +$pad-i-label--xl: props.def(--o-button--xl--pad-i-label, props.get(core.$size--150)) !default; +$pad-i-pill--xl: props.def(--o-action-button--xl--pad-i-pill, props.get(core.$size--300)) !default; +$pad-b--xl: props.def(--o-action-button--xl--pad-b, props.get(core.$size--150)) !default; +$font-size--xl: props.def(--o-action-button--xl--font-size, props.get(core.$font-size--200)) !default; $key-focus--border-width: props.def(--o-action-button--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; $key-focus--border-offset: props.def(--o-action-button--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; $key-focus--outline-width: props.def(--o-action-button--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default; $fixed-sizes: ( - 'sm' $pad-i--sm $pad-i-pill--sm $pad-b--sm $font-size--sm, - 'lg' $pad-i--lg $pad-i-pill--lg $pad-b--lg $font-size--lg, - 'xl' $pad-i--xl $pad-i-pill--xl $pad-b--xl $font-size--xl, + 'sm' $pad-i--sm $pad-i-label--sm $pad-i-pill--sm $pad-b--sm $font-size--sm, + 'lg' $pad-i--lg $pad-i-label--lg $pad-i-pill--lg $pad-b--lg $font-size--lg, + 'xl' $pad-i--xl $pad-i-label--xl $pad-i-pill--xl $pad-b--xl $font-size--xl, ) !default; $themes: props.def(--o-action-button, (), 'color'); diff --git a/src/objects/_button.vars.scss b/src/objects/_button.vars.scss index 65993ad..36400a2 100644 --- a/src/objects/_button.vars.scss +++ b/src/objects/_button.vars.scss @@ -11,7 +11,7 @@ $border-width: props.def(--o-button--border-width, props.get(core.$border-width- $rounding: props.def(--o-button--rounding, 10em) !default; $font-size: props.def(--o-button--font-size, props.get(core.$font-size--100)) !default; -$pad-i--sm: props.def(--o-button--sm--pad-i, props.get(core.$size--125)) !default; +$pad-i--sm: props.def(--o-button--sm--pad-i, props.get(core.$size--150)) !default; $pad-i-label--sm: props.def(--o-button--sm--pad-i-label, props.get(core.$size--25)) !default; $pad-b--sm: props.def(--o-button--sm--pad-b, props.get(core.$size--25)) !default; $font-size--sm: props.def(--o-button--sm--font-size, props.get(core.$font-size--75)) !default; diff --git a/tpl/objects/action-button.pug b/tpl/objects/action-button.pug index c3a9b53..e9b6fe3 100644 --- a/tpl/objects/action-button.pug +++ b/tpl/objects/action-button.pug @@ -26,4 +26,9 @@ mixin action-button if attributes.icon +icon(attributes.icon) = ' ' - block + if block + span.o-action-button__label + block + if attributes.postIcon + = ' ' + +icon(attributes.postIcon) -- cgit v1.2.3-70-g09d2