From 71da0fd8d8da2efdef33a2e21f8421890c06e468 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 21 Jul 2025 18:23:53 +0200 Subject: Action button: add static mod --- src/objects/_action-button.scss | 43 ++++++++++++++++++++++++++++++++++------- tpl/objects/action-button.pug | 2 +- tpl/views/action-button.pug | 43 ++++++++++++++++++++++++++++++++++------- 3 files changed, 73 insertions(+), 15 deletions(-) diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss index 7863f50..f4a9a46 100644 --- a/src/objects/_action-button.scss +++ b/src/objects/_action-button.scss @@ -52,6 +52,35 @@ } } + @include bem.modifier('static') { + color: props.get($theme, list.join($key, --quiet --hover --label-color)...); + background-color: props.get($theme, list.join($key, --quiet --hover --bg-color)...); + border-color: transparent; + box-shadow: none; + + &:link, + &:visited, + &:enabled { + color: props.get($theme, list.join($key, --quiet --hover --label-color)...); + background-color: props.get($theme, list.join($key, --quiet --hover --bg-color)...); + border-color: transparent; + box-shadow: none; + + &:hover, + &:focus-visible { + color: props.get($theme, list.join($key, --quiet --active --label-color)...); + background-color: props.get($theme, list.join($key, --quiet --active --bg-color)...); + border-color: transparent; + } + + &:active { + color: props.get($theme, list.join($key, --quiet --active --label-color)...); + background-color: props.get($theme, list.join($key, --quiet --active --bg-color)...); + border-color: transparent; + } + } + } + @include bem.modifier('quiet') { color: props.get($theme, list.join($key, --quiet --disabled --label-color)...); background-color: transparent; @@ -80,11 +109,17 @@ } } - @include bem.is('selected', 'badge') { + @include bem.is('selected') { color: props.get($theme, list.join($key, --selected --disabled --label-color)...); background-color: props.get($theme, list.join($key, --selected --disabled --bg-color)...); border-color: props.get($theme, list.join($key, --selected --disabled --border-color)...); + @include bem.modifier('static') { + color: props.get($theme, list.join($key, --selected --label-color)...); + background-color: props.get($theme, list.join($key, --selected --bg-color)...); + border-color: props.get($theme, list.join($key, --selected --border-color)...); + } + &:link, &:visited, &:enabled { @@ -106,12 +141,6 @@ } } } - - @include bem.is('badge') { - color: props.get($theme, list.join($key, --selected --label-color)...); - background-color: props.get($theme, list.join($key, --selected --bg-color)...); - border-color: props.get($theme, list.join($key, --selected --border-color)...); - } } @mixin styles { diff --git a/tpl/objects/action-button.pug b/tpl/objects/action-button.pug index 0ab084e..0e77e58 100644 --- a/tpl/objects/action-button.pug +++ b/tpl/objects/action-button.pug @@ -8,7 +8,7 @@ mixin action-button 'o-action-button--secondary': attributes.secondary, 'o-action-button--quiet': attributes.quiet, 'o-action-button--pill': attributes.pill, - 'o-action-button--badge': attributes.badge, + 'o-action-button--static': attributes.static, 'o-action-button--icon': !!attributes.icon && !block, 'is-selected': attributes.selected, } diff --git a/tpl/views/action-button.pug b/tpl/views/action-button.pug index 025bd78..4d2ffb6 100644 --- a/tpl/views/action-button.pug +++ b/tpl/views/action-button.pug @@ -62,13 +62,6 @@ mixin view-action-button +action-button(icon='trash') br br - +action-button(secondary=true)= 'Label' - = ' ' - +action-button(secondary=true icon='trash')= 'Label' - = ' ' - +action-button(secondary=true icon='trash') - br - br +action-button(quiet=true)= 'Label' = ' ' +action-button(quiet=true icon='trash')= 'Label' @@ -85,6 +78,15 @@ mixin view-action-button +action-button(selected=true disabled=true)= 'Selected + disabled' br br + +action-button(static=true )= 'Idle' + = ' ' + +action-button(static=true selected=true)= 'Selected' + = ' ' + +action-button(static=true disabled=true)= 'Disabled' + = ' ' + +action-button(static=true selected=true disabled=true)= 'Selected + disabled' + br + br +action-button(quiet=true )= 'Idle' = ' ' +action-button(quiet=true selected=true)= 'Selected' @@ -103,6 +105,15 @@ mixin view-action-button +action-button(pill=true selected=true disabled=true)= 'Selected + disabled' br br + +action-button(pill=true static=true)= 'Idle' + = ' ' + +action-button(pill=true static=true selected=true)= 'Selected' + = ' ' + +action-button(pill=true static=true disabled=true)= 'Disabled' + = ' ' + +action-button(pill=true static=true selected=true disabled=true)= 'Selected + disabled' + br + br +action-button(pill=true quiet=true)= 'Idle' = ' ' +action-button(pill=true quiet=true selected=true)= 'Selected' @@ -122,6 +133,15 @@ mixin view-action-button +action-button(theme=theme selected=true disabled=true)= 'Selected + disabled' br br + +action-button(theme=theme static=true)= 'Idle' + = ' ' + +action-button(theme=theme static=true selected=true)= 'Selected' + = ' ' + +action-button(theme=theme static=true disabled=true)= 'Disabled' + = ' ' + +action-button(theme=theme static=true selected=true disabled=true)= 'Selected + disabled' + br + br +action-button(theme=theme quiet=true)= 'Idle' = ' ' +action-button(theme=theme quiet=true selected=true)= 'Selected' @@ -144,6 +164,15 @@ mixin view-action-button +action-button(theme=theme selected=true disabled=true)= 'Selected + disabled' br br + +action-button(theme=theme static=true)= 'Idle' + = ' ' + +action-button(theme=theme static=true selected=true)= 'Selected' + = ' ' + +action-button(theme=theme static=true disabled=true)= 'Disabled' + = ' ' + +action-button(theme=theme static=true selected=true disabled=true)= 'Selected + disabled' + br + br +action-button(theme=theme quiet=true)= 'Idle' = ' ' +action-button(theme=theme quiet=true selected=true)= 'Selected' -- cgit v1.2.3-70-g09d2