From 48cb00040763459fc46d4aa108bf72c12f48f422 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 21 Jun 2024 23:07:50 +0200 Subject: WIP: Refactoring --- src/.old/objects/_badge.scss | 173 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 src/.old/objects/_badge.scss (limited to 'src/.old/objects/_badge.scss') diff --git a/src/.old/objects/_badge.scss b/src/.old/objects/_badge.scss new file mode 100644 index 0000000..0f73382 --- /dev/null +++ b/src/.old/objects/_badge.scss @@ -0,0 +1,173 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('badge') { + @include iro.props-store(( + --dims: ( + --pad-x: fn.px-to-em(4px), + --pad-y: 0, + --rounding: 3px, + --fixed-100: 1em, + --fixed-200: 1.5em, + + --200: ( + --pad-x: fn.px-to-em(6px), + --pad-y: fn.px-to-em(2px), + ), + --300: ( + --pad-x: fn.px-to-em(10px), + --pad-y: fn.px-to-em(6px), + ), + + --pill: ( + --pad-x: fn.px-to-em(9px), + + --200: ( + --pad-x: fn.px-to-em(10px), + ), + --300: ( + --pad-x: fn.px-to-em(16px), + ), + ), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-lo), + --hover: ( + --bg: fn.global-color(--obj), + ), + --active: ( + --bg: fn.global-color(--obj-lo), + ), + --key-focus: ( + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + + --primary: ( + --bg: fn.global-color(--fg-lo), + --label: fn.global-color(--bg), + --hover: ( + --bg: fn.global-color(--fg), + ), + --active: ( + --bg: fn.global-color(--fg), + ), + ), + + --accent: ( + --bg: fn.global-color(--accent --primary --solid --bg), + --label: fn.global-color(--accent --primary --solid --fg), + --hover: ( + --bg: fn.global-color(--accent --primary --solid --obj), + ), + --active: ( + --bg: fn.global-color(--accent --primary --solid --obj-lo), + ), + ), + + --accent-quiet: ( + --bg: fn.global-color(--accent --primary --quiet --bg), + --label: fn.global-color(--accent --primary --quiet --fg), + --hover: ( + --bg: fn.global-color(--accent --primary --quiet --obj), + ), + --active: ( + --bg: fn.global-color(--accent --primary --quiet --obj-lo), + ), + ) + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + margin-top: -.5em; + margin-bottom: -.5em; + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + color: fn.color(--label); + line-height: fn.global-dim(--font --standard --line-height); + text-align: center; + text-decoration: none; + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--hover --bg); + } + + &:active { + background-color: fn.color(--active --bg); + } + } + + @each $variant in 'primary' 'accent' 'accent-quiet' { + @include iro.bem-modifier($variant) { + background-color: fn.color(--#{$variant} --bg); + color: fn.color(--#{$variant} --label); + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--#{$variant} --hover --bg); + } + + &:active { + background-color: fn.color(--#{$variant} --active --bg); + } + } + } + } + + &:link, + &:visited, + &:enabled { + @include iro.bem-at-theme('keyboard') { + &:focus { + background-color: transparent; + box-shadow: inset 0 0 0 2px fn.color(--key-focus --border), fn.color(--key-focus --shadow); + color: currentColor; + } + } + } + + @include iro.bem-modifier('pill') { + padding-right: fn.dim(--pill --pad-x); + padding-left: fn.dim(--pill --pad-x); + border-radius: 10em; + } + + @each $size in '200' '300' { + @include iro.bem-modifier($size) { + padding: fn.dim(--#{$size} --pad-y) fn.dim(--#{$size} --pad-x); + + @include iro.bem-modifier('pill') { + padding-right: fn.dim(--pill --#{$size} --pad-x); + padding-left: fn.dim(--pill --#{$size} --pad-x); + } + } + } + + @include iro.bem-modifier('fixed-100') { + width: fn.dim(--fixed-100); + } + + @include iro.bem-modifier('fixed-200') { + width: fn.dim(--fixed-200); + } + + @include iro.bem-modifier('sm') { + font-size: fn.global-dim(--font-size --75); + } + + @include iro.bem-modifier('xs') { + font-size: fn.global-dim(--font-size --50); + } + } +} -- cgit v1.2.3-54-g00ecf