summaryrefslogtreecommitdiffstats
path: root/src/objects/_bubble.scss
blob: 477f47558e2a1e975acbf4f5ea21e71781d3f0d3 (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
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('bubble') {
    @include iro.props-store((
        --dims: (
            --pad-x:      fn.global-dim(--size --200),
            --pad-y:      fn.global-dim(--size --150),
            --rounding:   0,
            --arrow-size: fn.global-dim(--size --100),

            --75: (
                --pad-x: fn.global-dim(--size --150),
                --pad-y: fn.global-dim(--size --85),
            ),
        )
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --highlight: fn.global-color(--fg-lo),
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        position:         relative;
        padding:          fn.dim(--pad-y) fn.dim(--pad-x);
        border-radius:    fn.dim(--rounding);
        background-color: fn.global-color(--bg);
        color:            fn.global-color(--fg);

        &::before,
        &::after {
            content:             '';
            display:             none;
            position:            absolute;
            top:                 0;
            border:              fn.dim(--arrow-size) solid fn.global-color(--bg);
            border-bottom-color: transparent;
        }

        &::before {
            left:              calc(-1 * fn.dim(--arrow-size));
            border-left-color: transparent;
        }

        &::after {
            right:              calc(-1 * fn.dim(--arrow-size));
            border-right-color: transparent;
        }

        @include iro.bem-modifier('highlight') {
            box-shadow: -3px 0 0 0 fn.color(--highlight);
        }
        
        @include iro.bem-elem('suffix') {
            margin-left: 1em;
            float:       right;
            transform:   translate(.2em, .2em);
        }
        
        @include iro.bem-modifier('75') {
            padding: fn.dim(--75 --pad-y) fn.dim(--75 --pad-x);
        }
    }
}