summaryrefslogtreecommitdiffstats
path: root/src/objects/_lightbox.scss
blob: 4964b817db8569f97988c7e5584105570179738c (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
@use 'sass:map';
@use 'sass:meta';
@use 'sass:string';
@use 'iro-sass/src/bem';
@use 'iro-sass/src/props';
@use '../props' as *;

@forward 'lightbox.vars';
@use 'lightbox.vars' as vars;

@mixin styles {
    @include materialize-at-root(meta.module-variables('vars'));

    @include bem.object('lightbox') {
        flex:           1 1 auto;
        min-block-size: 0;

        @include bem.elem('header') {
            display:             flex;
            grid-area:           header;
            align-items:         flex-start;
            padding-block-start: props.get(vars.$pad);
            padding-inline:      props.get(vars.$pad);
        }

        @include bem.elem('img') {
            box-sizing:      border-box;
            display:         block;
            grid-area:       content;
            place-self:      center;
            inline-size:     auto;
            max-inline-size: 100%;
            block-size:      auto;
            max-block-size:  props.get(vars.$image--max-height);
            padding:         props.get(vars.$pad);
            margin-inline:   auto;
        }

        @include bem.elem('thumbnails') {
            display:            none;
            grid-area:          thumbnails;
            gap:                props.get(vars.$thumbnail--spacing);
            padding:            props.get(vars.$pad);
            margin-block-start: calc(-1 * props.get(vars.$pad));
            overflow:           auto;
        }

        @include bem.elem('close-btn') {
            display:            none;
            flex:               0 0 auto;
            margin-block-start: calc(-.5 * props.get(vars.$pad));
            margin-inline:      auto calc(-.5 * props.get(vars.$pad));
            font-size:          props.get(vars.$close-button--font-size);
        }

        @include bem.elem('nav-btn') {
            position:   relative;
            display:    none;
            align-self: center;
            overflow:   visible;
            font-size:  props.get(vars.$nav-button--font-size);

            &::before {
                position:           absolute;
                inset-block-start:  50%;
                display:            block;
                inline-size:        props.get(vars.$nav-button--inline-size);
                block-size:         props.get(vars.$nav-button--block-size);
                content:            '';
                transform:          translateY(-50%);
            }

            @include bem.modifier('prev') {
                grid-area:     prev;
                margin-inline: calc(.5 * props.get(vars.$pad)) calc(-1 * props.get(vars.$pad));

                &::before {
                    inset-inline-start: 0;
                }
            }
    
            @include bem.modifier('next') {
                grid-area:     next;
                margin-inline: calc(-1 * props.get(vars.$pad)) calc(.5 * props.get(vars.$pad));

                &::before {
                    inset-inline-end: 0;
                }
            }
        }

        @include bem.modifier('interactive') {
            display:               grid;
            grid-template-areas:
                'header     header     header'
                'prev       content    next'
                'thumbnails thumbnails thumbnails';
            grid-template-rows:    auto minmax(0, 1fr) auto auto;
            grid-template-columns: auto minmax(0, 1fr) auto;

            @include bem.elem('img') {
                display:        none;
                max-block-size: 100%;
                margin-inline:  0;

                @include bem.multi('&:target', 'is' 'visible') {
                    display: block;
                }
            }

            @include bem.elem('thumbnails') {
                display: flex;
            }

            @include bem.elem('close-btn') {
                display: block;
            }

            @include bem.elem('nav-btn') {
                display: block;
            }
        }

        @each $theme in map.keys(props.get(vars.$static-themes)) {
            @include bem.modifier(string.slice($theme, 3)) {
                color: props.get(vars.$static-themes, $theme, --text);
            }
        }
    }
}