summaryrefslogtreecommitdiffstats
path: root/src/layouts/_bubble-group.scss
blob: b4062a1d82250d679aeb7f4078cbb4bac499145e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('bubble-group') {
    @include iro.props-store((
        --dims: (
            --spacing-x: fn.global-dim(--size --225),
            --spacing-y: fn.global-dim(--size --150),

            --compact: (
                --spacing-x: fn.global-dim(--size --225),
                --spacing-y: fn.global-dim(--size --50),
            )
        )
    ), 'dims');

    @include iro.bem-layout(iro.props-namespace()) {
        display:               grid;
        grid-template-columns: auto 1fr;
        grid-auto-rows:        auto;
        grid-template-areas:   'avatar bubble' 'avatar .';
        align-items:           flex-start;
        gap:                   fn.dim(--spacing-y) fn.dim(--spacing-x);
        
        @include iro.bem-elem('avatar') {
            grid-area: avatar;
        }
        
        @include iro.bem-elem('bubble') {
            grid-column: bubble;
            box-sizing:  border-box;
            min-width:   0;
            max-width:   100%;
        }
        
        @include iro.bem-modifier('compact') {
            gap: fn.dim(--compact --spacing-y) fn.dim(--compact --spacing-x);
        
            @include iro.bem-modifier('left') {
                justify-items: start;
            }
        
            @include iro.bem-modifier('right') {
                justify-items: end;
            }
        }
        
        @include iro.bem-modifier('right') {
            grid-template-columns: 1fr auto;
            grid-template-areas:   'bubble avatar' '. avatar';
        }
        
        @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') {
                    &::before {
                        display: block;
                    }
                }
            }
        
            @include iro.bem-modifier('right') {
                @include iro.bem-elem('avatar') {
                    @include iro.bem-next-elem('bubble') {
                        &::before {
                            display: none;
                        }

                        &::after {
                            display: block;
                        }
                    }
                }
            }
        }
    }
}