summaryrefslogtreecommitdiffstats
path: root/src/scopes/_code.scss
blob: 0ff3a2cef45357cc0336b8604877344c427ffc63 (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
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('code') {
    @include iro.props-store((
        --dims: (
            --inline: (
                --pad-i:    fn.global-dim(--size --50),
                --pad-b:    fn.global-dim(--size --10),
                --rounding: fn.global-dim(--rounding),
            ),
            --block: (
                --pad-i:      fn.global-dim(--size --150),
                --pad-b:      fn.global-dim(--size --85),
                --margin-bs:  fn.global-dim(--paragraph --margin-bs),
                --rounding:   fn.global-dim(--rounding),
            )
        ),
        --colors: (
            --inline: (
                --fg: fn.global-color(--red --1100),
                --bg: fn.global-color(--red --200),
            ),
            --block: (
                --fg: fn.global-color(--text),
                --bg: fn.global-color(--base --50),
            )
        )
    ));

    @include iro.bem-scope(iro.props-namespace()) {
        code {
            padding-block:    fn.dim(--inline --pad-b);
            padding-inline:   fn.dim(--inline --pad-i);
            border-radius:    fn.dim(--inline --rounding);
            background-color: fn.color(--inline --bg);
            color:            fn.color(--inline --fg);
        }

        pre {
            margin-block:     fn.dim(--block --margin-bs) 0;
            margin-inline:    0;
            padding-block:    fn.dim(--block --pad-b);
            padding-inline:   fn.dim(--block --pad-i);
            border-radius:    fn.dim(--block --rounding);
            background-color: fn.color(--block --bg);
            color:            fn.color(--block --fg);

            code {
                display:           inline-block;
                margin-inline-end: fn.dim(--block --pad-i);
                padding:           0;
                border-radius:     0;
                background-color:  transparent;
                color:             currentColor;
            }
        }
    }
}