From 57e28f7fe929f275a0c516d0a702ec8a8739a810 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 27 Jun 2024 11:26:15 +0200 Subject: Add card --- src/_utils.scss | 8 +++++--- src/layouts/_media.scss | 51 ++++++++++++------------------------------------- src/objects/_card.scss | 24 ++++++++++++++++++++--- 3 files changed, 38 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/_utils.scss b/src/_utils.scss index 8ba2581..a99d7ec 100644 --- a/src/_utils.scss +++ b/src/_utils.scss @@ -11,7 +11,9 @@ $dirs: ( 'is': '-inline-start', 'ie': '-inline-end', 'i': '-inline', -); +) !default; + +$sizes: 0 10 50 75 100 125 200 400 700 800 !default; @include iro.bem-utility('d-block') { display: block; @@ -177,7 +179,7 @@ $dirs: ( padding#{$suffix}: auto; } - @each $size in (0 10 50 75 100 125 200 400 700 800) { + @each $size in $sizes { @include iro.bem-utility('m#{$dir}-#{$size}') { margin#{$suffix}: fn.global-dim(--size --#{$size}); } @@ -192,6 +194,6 @@ $dirs: ( } @include iro.bem-utility('b#{$dir}-1') { - border#{$suffix}: 1px solid fn.global-color(--border); + border#{$suffix}: fn.global-dim(--border --thin) solid fn.global-color(--border); } } diff --git a/src/layouts/_media.scss b/src/layouts/_media.scss index 953c8c0..1227486 100644 --- a/src/layouts/_media.scss +++ b/src/layouts/_media.scss @@ -1,57 +1,30 @@ @use 'iro-sass/src/index' as iro; @use '../functions' as fn; +$sizes: 'gapless' 'sm' 'lg' 'xl' !default; + @include iro.props-namespace('media') { @include iro.props-store(( --dims: ( - --pad-x: fn.global-dim(--size --150), - --pad-y: fn.global-dim(--size --85), - - --75: ( - --pad-x: fn.global-dim(--size --100), - --pad-y: fn.global-dim(--size --50), - ), + --gap: fn.global-dim(--size --150), - --200: ( - --pad-x: fn.global-dim(--size --300), - --pad-y: fn.global-dim(--size --150), - ), - - --300: ( - --pad-x: fn.global-dim(--size --450), - --pad-y: fn.global-dim(--size --225), - ) + --gapless: 0, + --sm: fn.global-dim(--size --100), + --lg: fn.global-dim(--size --300), + --xl: fn.global-dim(--size --450), ) )); @include iro.bem-layout(iro.props-namespace()) { display: flex; align-items: center; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - gap: fn.dim(--pad-x); + gap: fn.dim(--gap); line-height: 1.4; - @include iro.bem-modifier('75') { - padding: fn.dim(--75 --pad-y) fn.dim(--75 --pad-x); - gap: fn.dim(--75 --pad-x); - } - - @include iro.bem-modifier('200') { - padding: fn.dim(--200 --pad-y) fn.dim(--200 --pad-x); - gap: fn.dim(--200 --pad-x); - } - - @include iro.bem-modifier('300') { - padding: fn.dim(--300 --pad-y) fn.dim(--300 --pad-x); - gap: fn.dim(--300 --pad-x); - } - - @include iro.bem-modifier('flush') { - padding: 0; - } - - @include iro.bem-modifier('gapless') { - gap: 0; + @each $size in $sizes { + @include iro.bem-modifier($size) { + gap: fn.dim(--#{$size}); + } } @include iro.bem-modifier('wrap') { diff --git a/src/objects/_card.scss b/src/objects/_card.scss index 07256cb..5783ac1 100644 --- a/src/objects/_card.scss +++ b/src/objects/_card.scss @@ -53,13 +53,21 @@ } } - @include iro.bem-elem('thumbnail') { + @include iro.bem-elem('avatar') { + margin-block-start: fn.dim(--pad-b); + margin-inline-start: fn.dim(--pad-i); + } + + @include iro.bem-elem('image') { position: relative; width: 100%; - height: 100%; + + @include iro.bem-next-elem('avatar') { + margin-block-start: calc(-.7 * fn.foreign-dim(--avatar, --xl --size)); + } } - @include iro.bem-elem('thumbnail-img') { + @include iro.bem-elem('image-img') { display: block; object-fit: cover; width: 100%; @@ -69,6 +77,16 @@ @include iro.bem-elem('body') { padding-block: fn.dim(--pad-b); padding-inline: fn.dim(--pad-i); + + &::before { + content: ''; + display: block; + margin-block: -100em 100em; + } + } + + @include iro.bem-elem('content') { + margin-block-start: fn.dim(--spacing); } @include iro.bem-elem('footer') { -- cgit v1.2.3-70-g09d2