diff options
author | Volpeon <git@volpeon.ink> | 2023-10-19 11:47:17 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2023-10-19 11:47:17 +0200 |
commit | 47d6ec3256174a518d5cd370fe9aa9197c804f5a (patch) | |
tree | 9ad531ea8d9e5e3a5c4181cbd48cb0b88f1b0ecd | |
parent | Update (diff) | |
download | iro-design-47d6ec3256174a518d5cd370fe9aa9197c804f5a.tar.gz iro-design-47d6ec3256174a518d5cd370fe9aa9197c804f5a.tar.bz2 iro-design-47d6ec3256174a518d5cd370fe9aa9197c804f5a.zip |
Implement bubble group with flex
-rw-r--r-- | src/layouts/_bubble-group.scss | 66 | ||||
-rw-r--r-- | tpl/objects/bubble-group.pug | 3 | ||||
-rw-r--r-- | tpl/views/bubble-group.pug | 19 |
3 files changed, 60 insertions, 28 deletions
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 @@ | |||
15 | ), 'dims'); | 15 | ), 'dims'); |
16 | 16 | ||
17 | @include iro.bem-layout(iro.props-namespace()) { | 17 | @include iro.bem-layout(iro.props-namespace()) { |
18 | display: grid; | 18 | display: flex; |
19 | grid-template-columns: auto 1fr; | 19 | align-items: flex-start; |
20 | grid-auto-rows: auto; | 20 | gap: fn.dim(--spacing-x); |
21 | grid-template-areas: 'avatar bubble'; | ||
22 | align-items: flex-start; | ||
23 | gap: fn.dim(--spacing-y) fn.dim(--spacing-x); | ||
24 | 21 | ||
25 | @include iro.bem-elem('avatar') { | 22 | @include iro.bem-elem('avatar') { |
26 | grid-area: avatar; | 23 | flex: 0 0 auto; |
27 | } | 24 | } |
28 | 25 | ||
29 | @include iro.bem-elem('bubble') { | 26 | @include iro.bem-elem('content') { |
30 | grid-column: bubble; | 27 | grid-column: content; |
31 | min-width: 0; | 28 | display: flex; |
29 | flex-direction: column; | ||
30 | min-width: 0; | ||
31 | gap: fn.dim(--spacing-y); | ||
32 | } | 32 | } |
33 | 33 | ||
34 | @include iro.bem-modifier('compact') { | 34 | @include iro.bem-modifier('compact') { |
35 | gap: fn.dim(--compact --spacing-y) fn.dim(--compact --spacing-x); | 35 | gap: fn.dim(--compact --spacing-x); |
36 | |||
37 | @include iro.bem-elem('content') { | ||
38 | gap: fn.dim(--compact --spacing-y); | ||
39 | } | ||
36 | 40 | ||
37 | @include iro.bem-modifier('left') { | 41 | @include iro.bem-modifier('left') { |
38 | justify-items: start; | 42 | @include iro.bem-elem('content') { |
43 | align-items: flex-start; | ||
44 | } | ||
39 | } | 45 | } |
40 | 46 | ||
41 | @include iro.bem-modifier('right') { | 47 | @include iro.bem-modifier('right') { |
42 | justify-items: end; | 48 | @include iro.bem-elem('content') { |
49 | align-items: flex-end; | ||
50 | } | ||
43 | } | 51 | } |
44 | } | 52 | } |
45 | 53 | ||
46 | @include iro.bem-modifier('right') { | 54 | @include iro.bem-modifier('right') { |
47 | grid-template-columns: 1fr auto; | 55 | flex-direction: row-reverse; |
48 | grid-template-areas: 'bubble avatar'; | ||
49 | } | 56 | } |
50 | 57 | ||
51 | @include iro.bem-modifier('no-avatar') { | 58 | @include iro.bem-modifier('no-avatar') { |
52 | grid-template-columns: 1fr; | ||
53 | grid-template-areas: 'bubble'; | ||
54 | |||
55 | @include iro.bem-elem('avatar') { | 59 | @include iro.bem-elem('avatar') { |
56 | display: none; | 60 | display: none; |
57 | } | 61 | } |
58 | } | 62 | } |
59 | 63 | ||
60 | @include iro.bem-modifier('arrow') { | 64 | @include iro.bem-modifier('arrow') { |
61 | @include iro.bem-elem('avatar') { | 65 | @include iro.bem-elem('bubble') { |
62 | @include iro.bem-next-elem('bubble') { | 66 | &::before { |
67 | display: block; | ||
68 | } | ||
69 | |||
70 | @include iro.bem-sibling-elem('bubble') { | ||
63 | &::before { | 71 | &::before { |
64 | display: block; | 72 | display: none; |
65 | } | 73 | } |
66 | } | 74 | } |
67 | } | 75 | } |
68 | 76 | ||
69 | @include iro.bem-modifier('right') { | 77 | @include iro.bem-modifier('right') { |
70 | @include iro.bem-elem('avatar') { | 78 | @include iro.bem-elem('bubble') { |
71 | @include iro.bem-next-elem('bubble') { | 79 | &::before { |
72 | &::before { | 80 | display: none; |
73 | display: none; | 81 | } |
74 | } | ||
75 | 82 | ||
83 | &::after { | ||
84 | display: block; | ||
85 | } | ||
86 | |||
87 | @include iro.bem-sibling-elem('bubble') { | ||
76 | &::after { | 88 | &::after { |
77 | display: block; | 89 | display: none; |
78 | } | 90 | } |
79 | } | 91 | } |
80 | } | 92 | } |
diff --git a/tpl/objects/bubble-group.pug b/tpl/objects/bubble-group.pug index 4fcb1a4..e22953d 100644 --- a/tpl/objects/bubble-group.pug +++ b/tpl/objects/bubble-group.pug | |||
@@ -14,4 +14,5 @@ mixin bubble-group(user) | |||
14 | section(class=classes) | 14 | section(class=classes) |
15 | .l-bubble-group__avatar.u-p-sticky-top | 15 | .l-bubble-group__avatar.u-p-sticky-top |
16 | +avatar= user.slice(0, 2) | 16 | +avatar= user.slice(0, 2) |
17 | block | 17 | .l-bubble-group__content |
18 | block | ||
diff --git a/tpl/views/bubble-group.pug b/tpl/views/bubble-group.pug index ce00067..dcdbe73 100644 --- a/tpl/views/bubble-group.pug +++ b/tpl/views/bubble-group.pug | |||
@@ -19,6 +19,25 @@ mixin view-bubble-group | |||
19 | +slot('time')= '12:39' | 19 | +slot('time')= '12:39' |
20 | 20 | ||
21 | .c-box.l-overflow(style='resize: vertical') | 21 | .c-box.l-overflow(style='resize: vertical') |
22 | +bubble-group('Volpeon')(compact=true right=true) | ||
23 | strong= 'Volpeon' | ||
24 | +bubble()(compact=true class='l-bubble-group__bubble') | ||
25 | +slot('body')= 'Compact bubbles test' | ||
26 | +slot('time')= '12:34' | ||
27 | +bubble()(compact=true class='l-bubble-group__bubble') | ||
28 | +slot('body')= loremIpsum | ||
29 | +slot('time')= '12:35' | ||
30 | +bubble()(compact=true class='l-bubble-group__bubble') | ||
31 | +slot('body')= 'qwertzuiop' | ||
32 | +slot('time')= '12:36' | ||
33 | +bubble()(compact=true class='l-bubble-group__bubble') | ||
34 | +slot('body')= '🐈️🦊️' | ||
35 | +slot('time')= '12:38' | ||
36 | +bubble()(compact=true class='l-bubble-group__bubble') | ||
37 | +slot('body')= loremIpsum | ||
38 | +slot('time')= '12:39' | ||
39 | |||
40 | .c-box.l-overflow(style='resize: vertical') | ||
22 | +bubble-group('Volpeon') | 41 | +bubble-group('Volpeon') |
23 | +bubble()(class='l-bubble-group__bubble') | 42 | +bubble()(class='l-bubble-group__bubble') |
24 | +slot('header') | 43 | +slot('header') |