From 3524f1bac11c8a9d1640bfeac5ceb063ff96d623 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 6 Feb 2022 17:17:33 +0100 Subject: Improved variable structure --- src/objects/_rule.scss | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 31 deletions(-) (limited to 'src/objects/_rule.scss') diff --git a/src/objects/_rule.scss b/src/objects/_rule.scss index bfd1240..b0679ee 100644 --- a/src/objects/_rule.scss +++ b/src/objects/_rule.scss @@ -1,54 +1,58 @@ @use 'iro-sass/src/index' as iro; +@use '../functions' as fn; @include iro.props-namespace('rule') { @include iro.props-store(( --dims: ( - --margin-y: iro.props-get(--dims --spacing --y --xs, $global: true), + --margin-y: fn.dim(--spacing --y --xs, $global: true), --strong: ( - --border-width: iro.props-get(--dims --border-width --thick, $global: true), - --label-font-size: iro.props-get(--dims --font-size --md, $global: true), + --border-width: fn.dim(--border-width --thick, $global: true), + --label-font-size: fn.dim(--font-size --md, $global: true), ), --medium: ( - --border-width: iro.props-get(--dims --border-width --medium, $global: true), - --label-font-size: iro.props-get(--dims --font-size --sm, $global: true), + --border-width: fn.dim(--border-width --medium, $global: true), + --label-font-size: fn.dim(--font-size --sm, $global: true), ), --faint: ( - --border-width: iro.props-get(--dims --border-width --thin, $global: true), - --label-font-size: iro.props-get(--dims --font-size --xs, $global: true), + --border-width: fn.dim(--border-width --thin, $global: true), + --label-font-size: fn.dim(--font-size --xs, $global: true), ), ), + ), 'dims'); + + @include iro.props-store(( --colors: ( --strong: ( - --bg: iro.props-get(--colors --fg, $global: true), - --label: iro.props-get(--colors --fg, $global: true), + --bg: fn.color(--fg, $global: true), + --label: fn.color(--fg, $global: true), ), --medium: ( - --bg: iro.props-get(--colors --obj, $global: true), - --label: iro.props-get(--colors --fg-hi, $global: true), + --bg: fn.color(--obj, $global: true), + --label: fn.color(--fg-hi, $global: true), ), --faint: ( - --bg: iro.props-get(--colors --obj, $global: true), - --label: iro.props-get(--colors --fg-hi2, $global: true), + --bg: fn.color(--obj, $global: true), + --label: fn.color(--fg-hi2, $global: true), ), ), - )); + ), 'colors'); @include iro.bem-object(iro.props-namespace()) { display: block; - height: iro.props-get(--dims --strong --border-width); - margin-top: iro.props-get(--dims --margin-y); - margin-bottom: iro.props-get(--dims --margin-y); - background-color: iro.props-get(--colors --strong --bg); + height: fn.dim(--strong --border-width); + margin-top: fn.dim(--margin-y); + margin-bottom: fn.dim(--margin-y); + background-color: fn.color(--strong --bg); @include iro.bem-modifier('medium') { - height: iro.props-get(--dims --medium --border-width); - background-color: iro.props-get(--colors --medium --bg); + height: fn.dim(--medium --border-width); + background-color: fn.color(--medium --bg); } @include iro.bem-modifier('faint') { - height: iro.props-get(--dims --faint --border-width); - background-color: iro.props-get(--colors --faint --bg); + height: fn.dim(--faint --border-width); + background-color: fn.color(--faint --bg); } @include iro.bem-modifier('labelled') { @@ -66,7 +70,7 @@ flex: 1 1 auto; width: 100%; height: 3px; - background-color: iro.props-get(--colors --strong --bg); + background-color: fn.color(--strong --bg); } &::before { @@ -79,8 +83,8 @@ @include iro.bem-elem('label') { flex: 0 0 auto; - color: iro.props-get(--colors --strong --label); - font-size: iro.props-get(--dims --strong --label-font-size); + color: fn.color(--strong --label); + font-size: fn.dim(--strong --label-font-size); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; @@ -90,12 +94,12 @@ &::before, &::after { height: 2px; - background-color: iro.props-get(--colors --medium --bg); + background-color: fn.color(--medium --bg); } @include iro.bem-elem('label') { - color: iro.props-get(--colors --medium --label); - font-size: iro.props-get(--dims --medium --label-font-size); + color: fn.color(--medium --label); + font-size: fn.dim(--medium --label-font-size); font-weight: 500; } } @@ -104,12 +108,12 @@ &::before, &::after { height: 1px; - background-color: iro.props-get(--colors --faint --bg); + background-color: fn.color(--faint --bg); } @include iro.bem-elem('label') { - color: iro.props-get(--colors --faint --label); - font-size: iro.props-get(--dims --faint --label-font-size); + color: fn.color(--faint --label); + font-size: fn.dim(--faint --label-font-size); font-weight: 500; } } -- cgit v1.2.3-54-g00ecf