From 365c56edcc36b5b92902bac01ce44b43d01e8685 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 18 Oct 2024 18:08:24 +0200 Subject: Refactoring --- src/objects/_table.scss | 168 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 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..5b16d66 --- /dev/null +++ b/src/objects/_table.scss @@ -0,0 +1,168 @@ +@use 'iro-sass/src/iro-sass' 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), + + --sm: ( + --pad-b: fn.global-dim(--size --75), + ) + ), + --colors: ( + --border: fn.global-color(--border), + --heading: fn.global-color(--heading), + --hover: fn.global-color(--border-mute), + --active: fn.global-color(--border), + --box: ( + --bg: fn.global-color(--base --50), + --hover: fn.global-color(--bg-base), + --active: 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-block: fn.dim(--pad-b); + + padding-inline: fn.dim(--pad-i); + color: fn.color(--heading); + text-align: start; + } + + @include iro.bem-elem('cell') { + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border-color: fn.color(--border); + border-style: solid; + border-width: 0; + border-block-start-width: fn.dim(--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(--active); + } + } + } + + @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 --active); + } + } + } + } + } + + @include iro.bem-modifier('sm') { + @include iro.bem-elem('head-cell', 'cell') { + padding-block: fn.dim(--sm --pad-b); + } + } + } +} -- cgit v1.2.3-70-g09d2