From 47d6ec3256174a518d5cd370fe9aa9197c804f5a Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 19 Oct 2023 11:47:17 +0200 Subject: Implement bubble group with flex --- src/layouts/_bubble-group.scss | 66 +++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/layouts/_bubble-group.scss b/src/layouts/_bubble-group.scss index d63930a..c0e8e43 100644 --- a/src/layouts/_bubble-group.scss +++ b/src/layouts/_bubble-group.scss @@ -15,66 +15,78 @@ ), 'dims'); @include iro.bem-layout(iro.props-namespace()) { - display: grid; - grid-template-columns: auto 1fr; - grid-auto-rows: auto; - grid-template-areas: 'avatar bubble'; - align-items: flex-start; - gap: fn.dim(--spacing-y) fn.dim(--spacing-x); + display: flex; + align-items: flex-start; + gap: fn.dim(--spacing-x); @include iro.bem-elem('avatar') { - grid-area: avatar; + flex: 0 0 auto; } - @include iro.bem-elem('bubble') { - grid-column: bubble; - min-width: 0; + @include iro.bem-elem('content') { + grid-column: content; + display: flex; + flex-direction: column; + min-width: 0; + gap: fn.dim(--spacing-y); } @include iro.bem-modifier('compact') { - gap: fn.dim(--compact --spacing-y) fn.dim(--compact --spacing-x); + gap: fn.dim(--compact --spacing-x); + + @include iro.bem-elem('content') { + gap: fn.dim(--compact --spacing-y); + } @include iro.bem-modifier('left') { - justify-items: start; + @include iro.bem-elem('content') { + align-items: flex-start; + } } @include iro.bem-modifier('right') { - justify-items: end; + @include iro.bem-elem('content') { + align-items: flex-end; + } } } @include iro.bem-modifier('right') { - grid-template-columns: 1fr auto; - grid-template-areas: 'bubble avatar'; + flex-direction: row-reverse; } @include iro.bem-modifier('no-avatar') { - grid-template-columns: 1fr; - grid-template-areas: 'bubble'; - @include iro.bem-elem('avatar') { display: none; } } @include iro.bem-modifier('arrow') { - @include iro.bem-elem('avatar') { - @include iro.bem-next-elem('bubble') { + @include iro.bem-elem('bubble') { + &::before { + display: block; + } + + @include iro.bem-sibling-elem('bubble') { &::before { - display: block; + display: none; } } } @include iro.bem-modifier('right') { - @include iro.bem-elem('avatar') { - @include iro.bem-next-elem('bubble') { - &::before { - display: none; - } + @include iro.bem-elem('bubble') { + &::before { + display: none; + } + &::after { + display: block; + } + + @include iro.bem-sibling-elem('bubble') { &::after { - display: block; + display: none; } } } -- cgit v1.2.3-70-g09d2