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

@include iro.props-namespace('emoji') {
    @include iro.props-store((
        --dims: (
            --size:     calc(1 / 14 * 18em),
            --pad:      .3em,
            --rounding: 3px,
            --zoom:     3,
            --valign:   -.25em,

            --125: (
                --size:   calc(1 / 14 * 23em),
                --valign: -.45em,
            ),

            --150: (
                --size:   calc(1 / 14 * 28em),
                --valign: -.65em,
            ),

            --200: (
                --size:   calc(1 / 14 * 38em),
                --valign: -1em,
            )
        )
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --bg: fn.global-color(--obj-hi),
        )
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display:        inline-block;
        position:       relative;
        width:          calc(fn.dim(--size));
        height:         calc(fn.dim(--size));
        margin:         calc(-1 * fn.dim(--pad));
        padding:        calc(fn.dim(--pad));
        vertical-align: fn.dim(--valign);
        object-fit:     contain;

        @include iro.bem-modifier('icon') {
            margin:         calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--size) - fn.foreign-dim(--icon, --size)));
            vertical-align: fn.foreign-dim(--icon, --valign);
        }

        @each $size in '125' '150' '200' {
            @include iro.bem-modifier($size) {
                width:          fn.dim(--#{$size} --size);
                height:         fn.dim(--#{$size} --size);
                vertical-align: fn.dim(--#{$size} --valign);

                @include iro.bem-modifier('icon') {
                    margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--#{$size} --size) - fn.foreign-dim(--icon, --size)));
                }
            }
        }

        @include iro.bem-modifier('zoomable') {
            transition:    transform .2s ease, background-color .2s ease;
            border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom));

            &:hover {
                transform:        scale(fn.dim(--zoom));
                background-color: fn.color(--bg);
            }
        }
    }
}