summaryrefslogtreecommitdiffstats
path: root/src/objects/_dialog.scss
blob: 094e09b9bd48fb6a2772efbf3495b08825e4fcb4 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@use 'header';

@include iro.props-namespace('dialog') {
    @include iro.props-store((
        --dims: (
            --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: 8px,
            --border:   1px,

            --body: (
                --pad-x: fn.global-dim(--size --200),
                --pad-y: fn.global-dim(--size --200),
            )
        ),
    ), '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: (
            --border: rgba(#000, .2),
            --shadow: 0 .2em .5em rgba(#000, .2),

            --sidebar: (
                --border: fn.global-color(--obj),
            ),
        ),
    ), 'colors');

    @include iro.props-store((
        --colors: (
            --border: rgba(#fff, .2),
        ),
    ), 'colors-dark');

    @include iro.bem-object(iro.props-namespace()) {
        display:               grid;
        grid-template-rows:    auto 1fr auto;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            'sidebar-header header'
            'sidebar        body'
            'sidebar        footer';
        position:              relative;
        box-sizing:            border-box;
        width:                 100%;
        max-width:             fn.dim(--width-md);
        margin:                0 auto;
        overflow:              hidden;
        border:                fn.dim(--border) solid fn.color(--border);
        border-radius:         fn.dim(--rounding);
        background-clip:       padding-box;
        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('sidebar-header') {
            grid-area:    sidebar-header;
            border-right: 1px solid fn.color(--sidebar --border);

            @include iro.bem-sibling-elem('header') {
                grid-area: header;
            }
        }

        @include iro.bem-elem('header') {
            grid-area: sidebar-header / sidebar-header / header / header;
        }

        @include iro.bem-elem('close-btn') {
            margin-left: auto;
        }

        @include iro.bem-elem('label') {
            padding: 0 calc(fn.dim(--body --pad-x) - fn.foreign-dim(--header, --pad-x));
        }

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

        @include iro.bem-elem('body') {
            grid-area:  body;
            min-height: 0;
            padding:    fn.dim(--body --pad-y) fn.dim(--body --pad-x);
        }

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