From 6376f1a5225b2fa45f6c861d4a265bf13b56d038 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 29 Jun 2024 10:01:02 +0200 Subject: Update --- src/objects/_avatar.scss | 4 +- src/objects/_card.scss | 15 ++- src/objects/_lightbox.scss | 243 +++++++++++++++++++++++++++++++++++++ src/objects/_list-group.scss | 61 ---------- src/objects/_status-indicator.scss | 4 +- 5 files changed, 254 insertions(+), 73 deletions(-) create mode 100644 src/objects/_lightbox.scss delete mode 100644 src/objects/_list-group.scss (limited to 'src/objects') diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss index 5a34d19..19bff10 100644 --- a/src/objects/_avatar.scss +++ b/src/objects/_avatar.scss @@ -6,8 +6,8 @@ $sizes: 'xs' 'sm' 'lg' 'xl' 'xxl' 'xxxl'; @mixin status($size: ()) { @include iro.bem-elem('status') { - width: fn.dim(list.join($size, --indicator-size)); - height: fn.dim(list.join($size, --indicator-size)); + inline-size: fn.dim(list.join($size, --indicator-size)); + block-size: fn.dim(list.join($size, --indicator-size)); @include iro.bem-next-elem('content') { mask-image: radial-gradient( diff --git a/src/objects/_card.scss b/src/objects/_card.scss index 9f84d7a..c6c47d7 100644 --- a/src/objects/_card.scss +++ b/src/objects/_card.scss @@ -68,7 +68,7 @@ @include iro.bem-elem('image') { position: relative; - width: 100%; + inline-size: 100%; overflow: hidden; background-color: fn.color(--image-bg); @@ -88,10 +88,10 @@ } @include iro.bem-elem('image-img') { - display: block; - object-fit: cover; - width: 100%; - height: 100%; + display: block; + object-fit: cover; + inline-size: 100%; + block-size: 100%; } @include iro.bem-elem('body') { @@ -117,7 +117,7 @@ &::before { content: ''; display: block; - height: fn.dim(--divider); + block-size: fn.dim(--divider); margin-block: fn.dim(--spacing); background-color: fn.color(--divider); } @@ -132,8 +132,7 @@ &:hover, &:active { @include iro.bem-elem('image') { - outline: fn.dim(--border) solid fn.color(--quiet --hover --border); - outline-offset: calc(-1 * fn.dim(--key-focus --border) - fn.dim(--border)); + outline: fn.dim(--border) solid fn.color(--quiet --hover --border); } } diff --git a/src/objects/_lightbox.scss b/src/objects/_lightbox.scss new file mode 100644 index 0000000..7844eae --- /dev/null +++ b/src/objects/_lightbox.scss @@ -0,0 +1,243 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@use 'action-button'; + +$static-themes: 'black' 'white' !default; + +@include iro.props-namespace('lightbox') { + @include iro.props-store(( + --dims: ( + --pad: fn.global-dim(--size --150), + --thumbnail: ( + --size: fn.global-dim(--size --700), + --spacing: fn.global-dim(--size --100), + --idle: fn.global-dim(--border --thin), + --selected: fn.global-dim(--border --medium), + ), + --close-button: ( + --font-size: fn.global-dim(--font-size --200), + ), + --nav-button: ( + --width: fn.global-dim(--size --2000), + --height: fn.global-dim(--size --3800), + --font-size: fn.global-dim(--font-size --200), + ), + ), + --colors: ( + --thumbnail: ( + --idle: fn.global-color(--border-strong), + --selected: fn.global-color(--heading), + ), + ), + )); + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --text: fn.global-color(--white-transparent --800), + --thumbnail: ( + --idle: fn.global-color(--white-transparent --400), + --selected: fn.global-color(--white-transparent --900), + ), + ) + ) + )); + } + + @include iro.props-store(( + --dims: ( + --thumbnail: ( + --size: fn.global-dim(--size --600), + ), + --nav-button: ( + --width: fn.global-dim(--size --2500), + --height: fn.global-dim(--size --2500), + ), + ), + ), 'md'); + + @include iro.bem-object(iro.props-namespace()) { + display: grid; + grid-template-rows: auto minmax(0, 1fr) auto auto; + grid-template-columns: auto minmax(0, 1fr) auto; + grid-template-areas: + 'header header header' + 'prev content next' + 'thumbnails thumbnails thumbnails' + 'footer footer footer'; + box-sizing: border-box; + block-size: 100%; + min-block-size: 0; + + @include iro.bem-elem('header') { + grid-area: header; + display: flex; + align-items: flex-start; + padding-block-start: fn.dim(--pad); + padding-inline: fn.dim(--pad); + } + + @include iro.bem-elem('img') { + display: none; + box-sizing: border-box; + grid-area: content; + inline-size: 100%; + block-size: 100%; + padding: fn.dim(--pad); + object-fit: scale-down; + + @include iro.bem-sibling-elem('img') { + @include iro.bem-modifier('default') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + } + } + } + } + + @include iro.bem-multi('&:target', 'is' 'visible') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + } + } + + @include iro.bem-sibling-elem('img') { + @include iro.bem-modifier('default') { + display: none; + + @include iro.bem-next-elem('nav-btn') { + display: none; + + @include iro.bem-next-elem('nav-btn') { + display: none; + } + } + } + } + } + } + + @include iro.bem-elem('thumbnails') { + grid-area: thumbnails; + display: flex; + gap: fn.dim(--thumbnail --spacing); + padding-block: fn.dim(--thumbnail --selected) fn.dim(--pad); + padding-inline: fn.dim(--pad); + overflow: auto; + } + + @include iro.bem-elem('footer') { + grid-area: footer; + display: flex; + align-items: flex-start; + padding-block: 0 fn.dim(--pad); + padding-inline: fn.dim(--pad); + } + + @include iro.bem-elem('thumbnail') { + position: relative; + flex: 0 0 auto; + inline-size: fn.dim(--thumbnail --size); + block-size: fn.dim(--thumbnail --size); + outline: fn.dim(--thumbnail --idle) solid fn.color(--thumbnail --idle); + opacity: .75; + + &:hover, + &:focus-visible { + opacity: 1; + } + + @include iro.bem-is('selected') { + outline: fn.dim(--thumbnail --selected) solid fn.color(--thumbnail --selected); + opacity: 1; + } + } + + @include iro.bem-elem('thumbnail-img') { + display: block; + position: absolute; + inset-block-start: 0; + inset-inline-start: 0; + inline-size: 100%; + block-size: 100%; + object-fit: cover; + object-position: center center; + } + + @include iro.bem-elem('thumbnail-icon') { + position: absolute; + inset-block-start: 50%; + inset-inline-start: 50%; + transform: translate(-50%, -50%); + } + + @include iro.bem-elem('close-btn') { + flex: 0 0 auto; + margin-block-start: calc(-.5 * fn.dim(--pad)); + margin-inline: auto calc(-.5 * fn.dim(--pad)); + font-size: fn.dim(--close-button --font-size); + } + + @include iro.bem-elem('nav-btn') { + display: none; + position: relative; + align-self: center; + overflow: visible; + font-size: fn.dim(--nav-button --font-size); + + &::before { + content: ''; + display: block; + position: absolute; + inset-block-start: 50%; + inline-size: fn.dim(--nav-button --width); + block-size: fn.dim(--nav-button --height); + transform: translateY(-50%); + } + + @include iro.bem-modifier('prev') { + grid-area: prev; + margin-inline: calc(.5 * fn.dim(--pad)) calc(-1 * fn.dim(--pad)); + + &::before { + inset-inline-start: 0; + } + } + + @include iro.bem-modifier('next') { + grid-area: next; + margin-inline: calc(-1 * fn.dim(--pad)) calc(.5 * fn.dim(--pad)); + + &::before { + inset-inline-end: 0; + } + } + } + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + color: fn.color(--static-#{$theme} --text); + + @include iro.bem-elem('thumbnail') { + outline-color: fn.color(--static-#{$theme} --thumbnail --idle); + + @include iro.bem-is('selected') { + outline-color: fn.color(--static-#{$theme} --thumbnail --selected); + } + } + } + } + } +} diff --git a/src/objects/_list-group.scss b/src/objects/_list-group.scss deleted file mode 100644 index a346828..0000000 --- a/src/objects/_list-group.scss +++ /dev/null @@ -1,61 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('list-group') { - @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), - ), - --colors: ( - --bg: fn.global-color(--base --75), - --border: fn.global-color(--border), - --hover: fn.global-color(--border-mute), - --active: fn.global-color(--border), - ) - )); - - @include iro.bem-object(iro.props-namespace()) { - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - - @include iro.bem-elem('item') { - padding-block: fn.dim(--pad-b); - padding-inline: fn.dim(--pad-i); - - @include iro.bem-next-twin-elem { - border-width: 0; - border-block-start-width: fn.dim(--border); - border-style: solid; - border-color: fn.color(--border); - } - - @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { - &:hover, - &:focus-visible { - background-color: fn.color(--hover); - } - - &:active { - background-color: fn.color(--active); - } - } - } - - @include iro.bem-modifier('horizontal') { - display: flex; - - @include iro.bem-elem('item') { - flex: 1 0 auto; - - @include iro.bem-next-twin-elem { - border-block-start-width: 0; - border-inline-start-width: fn.dim(--border); - } - } - } - } -} diff --git a/src/objects/_status-indicator.scss b/src/objects/_status-indicator.scss index cadd395..416e65e 100644 --- a/src/objects/_status-indicator.scss +++ b/src/objects/_status-indicator.scss @@ -24,8 +24,8 @@ $themes: 'accent' 'positive' 'negative' 'warning' !default; @include iro.bem-object(iro.props-namespace()) { display: inline-block; - width: fn.dim(--size); - height: fn.dim(--size); + inline-size: fn.dim(--size); + block-size: fn.dim(--size); border-radius: 10em; background-color: fn.color(--default); vertical-align: middle; -- cgit v1.2.3-70-g09d2