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

@include iro.props-namespace('dialog') {
    @include iro.props-store((
        --dims: (
            --pad-x:              fn.global-dim(--size --400),
            --pad-y:              fn.global-dim(--size --400),
            --width-sm:           iro.fn-px-to-rem(500px),
            --width-md:           iro.fn-px-to-rem(800px),
            --width-lg:           iro.fn-px-to-rem(1100px),
            --rounding:           3px,
            --title-body-spacing: fn.global-dim(--size --150),
        ),
    ), 'dims');

    @include iro.props-store((
        --dims: (
            --pad-x: fn.global-dim(--size --300),
            --pad-y: fn.global-dim(--size --300),
        ),
    ), 'md');

    @include iro.props-store((
        --colors: (
            --shadow: 0 .2em .5em rgba(#000, .2),
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display:             grid;
        grid-template-rows:  auto auto 1fr auto;
        grid-template-areas: 'header' 'rule' 'body' 'footer';
        position:            relative;
        box-sizing:          border-box;
        width:               100%;
        max-width:           fn.dim(--width-md);
        margin:              0 auto;
        padding:             fn.dim(--pad-y) fn.dim(--pad-x);
        overflow:            hidden;
        border-radius:       fn.dim(--rounding);
        background-color:    fn.global-color(--bg);
        box-shadow:          fn.color(--shadow);
        color:               fn.global-color(--fg);

        @include iro.bem-modifier('sm') {
            max-width: fn.dim(--width-sm);
        }

        @include iro.bem-modifier('lg') {
            max-width: fn.dim(--width-lg);
        }

        @include iro.bem-elem('header') {
            grid-area:     header;
            margin-bottom: fn.dim(--title-body-spacing);
        }

        @include iro.bem-elem('close-btn') {
            position:  absolute;
            top:       iro.fn-px-to-rem(12px);
            right:     iro.fn-px-to-rem(12px);
            font-size: fn.global-dim(--font-size --150);
        }

        @include iro.bem-elem('rule') {
            grid-area: rule;
            margin:    0;
        }

        @include iro.bem-elem('title') {
            margin-top: 0;
        }

        @include iro.bem-elem('body') {
            grid-area:  body;
            min-height: 0;
            margin-top: fn.dim(--title-body-spacing);
        }

        @include iro.bem-elem('footer') {
            grid-area:       footer;
            justify-content: flex-end;
            margin-top:      fn.dim(--pad-y);
        }
    }
}