From 4de75e0f305b2cb4a026073440f2bac7c34df817 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 25 Jun 2024 17:39:03 +0200 Subject: Focus indicator style --- src/objects/_table.scss | 167 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 src/objects/_table.scss (limited to 'src/objects/_table.scss') diff --git a/src/objects/_table.scss b/src/objects/_table.scss new file mode 100644 index 0000000..cccf956 --- /dev/null +++ b/src/objects/_table.scss @@ -0,0 +1,167 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../mixins' as mx; + +@include iro.props-namespace('table') { + @include iro.props-store(( + --dims: ( + --pad-i: fn.global-dim(--size --175), + --pad-b: fn.global-dim(--size --125), + --rounding: fn.global-dim(--rounding), + --border: fn.global-dim(--border --thin), + --50: ( + --pad-b: fn.global-dim(--size --75), + ) + ), + --colors: ( + --border: fn.global-color(--border), + --heading: fn.global-color(--heading), + --hover: fn.global-color(--border-mute), + --press: fn.global-color(--border), + --box: ( + --bg: fn.global-color(--base --50), + --hover: fn.global-color(--bg-base), + --press: fn.global-color(--border-mute), + ) + ) + )); + + @include iro.bem-object(iro.props-namespace()) { + border-spacing: 0; + border-collapse: separate; + + @include iro.bem-modifier('fixed') { + table-layout: fixed; + } + + @include iro.bem-elem('head-cell') { + @include mx.set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(--font-size --50), + --weight: bold, + --transform: uppercase, + --spacing: .5px + )); + + padding-inline: fn.dim(--pad-i); + padding-block: fn.dim(--pad-b); + color: fn.color(--heading); + text-align: left; + } + + @include iro.bem-elem('cell') { + padding-inline: fn.dim(--pad-i); + padding-block: fn.dim(--pad-b); + border-width: 0; + border-block-start-width: fn.dim(--border); + border-style: solid; + border-color: fn.color(--border); + + @include iro.bem-modifier('divider') { + border-inline-end-width: fn.dim(--border); + } + } + + @include iro.bem-elem('row') { + &:last-child { + @include iro.bem-elem('cell') { + border-block-end-width: fn.dim(--border); + } + } + } + + @include iro.bem-modifier('flush') { + @include iro.bem-elem('head-cell', 'cell') { + &:first-child { + padding-inline-start: 0; + } + + &:last-child { + padding-inline-end: 0; + } + } + } + + @include iro.bem-modifier('box') { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --bg); + + &:first-child { + border-inline-start-width: fn.dim(--border); + } + + &:last-child { + border-inline-end-width: fn.dim(--border); + } + } + + @include iro.bem-elem('row') { + &:first-child { + @include iro.bem-elem('cell') { + &:first-child { + border-start-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-start-end-radius: fn.dim(--rounding); + } + } + } + + &:last-child { + @include iro.bem-elem('cell') { + &:first-child { + border-end-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-end-end-radius: fn.dim(--rounding); + } + } + } + } + } + + @include iro.bem-modifier('interactive') { + @include iro.bem-elem('row') { + @include iro.bem-elem('cell') { + cursor: pointer; + } + + &:hover { + @include iro.bem-elem('cell') { + background-color: fn.color(--hover); + } + } + + &:active { + @include iro.bem-elem('cell') { + background-color: fn.color(--press); + } + } + } + + @include iro.bem-modifier('box') { + @include iro.bem-elem('row') { + &:hover { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --hover); + } + } + + &:active { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --press); + } + } + } + } + } + + @include iro.bem-modifier('50') { + @include iro.bem-elem('head-cell', 'cell') { + padding-block: fn.dim(--50 --pad-b); + } + } + } +} -- cgit v1.2.3-54-g00ecf