summaryrefslogtreecommitdiffstats
path: root/src/objects/_lightbox.scss
blob: 3e4037d92d525bd7690bb26f5846a7989d164974 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@use 'action-button';

@include iro.props-namespace('lightbox') {
    @include iro.props-store((
        --dims: (
            --pad: fn.global-dim(--size --150),
            --thumbnail: (
                --size:     fn.global-dim(--size --700),
                --spacing:  fn.global-dim(--size --100),
                --selected: 2px,
            ),
            --close-button: (
                --font-size: fn.global-dim(--font-size --200),
            ),
            --nav-button: (
                --width:     fn.global-dim(--size --3800),
                --height:    fn.global-dim(--size --3800),
                --font-size: fn.global-dim(--font-size --200),
            ),
        ),
    ), 'dims');

    @include iro.props-store((
        --dims: (
            --thumbnail: (
                --size: fn.global-dim(--size --600),
            ),
            --nav-button: (
                --width:  fn.global-dim(--size --2500),
                --height: fn.global-dim(--size --2500),
            ),
        ),
    ), 'md');

    @include iro.props-store((
        --colors: (
            --thumbnail: (
                --selected: fn.global-color(--fg-lo),
            ),
            --footer: (
                --bg: fn.global-color(--bg-hi),
            ),
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display:               grid;
        grid-template-rows:    auto minmax(0, 1fr) auto auto;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            'header     header     header'
            'prev       content    next'
            'thumbnails thumbnails thumbnails'
            'footer     footer     footer';
        box-sizing:            border-box;
        height:                100%;
        overflow:              hidden;

        @include iro.bem-elem('header') {
            grid-area:   header;
            display:     flex;
            align-items: flex-start;
            padding:     fn.dim(--pad) fn.dim(--pad) 0;
        }

        @include iro.bem-elem('img') {
            box-sizing: border-box;
            grid-area:  content;
            max-width:  100%;
            max-height: 100%;
            margin:     auto;
            padding:    fn.dim(--pad);
        }

        @include iro.bem-elem('thumbnails') {
            grid-area: thumbnails;
            display:   flex;
            gap:       fn.dim(--thumbnail --spacing);
            padding:   fn.dim(--thumbnail --selected) fn.dim(--pad) fn.dim(--pad);
            overflow:  auto;
        }

        @include iro.bem-elem('footer') {
            grid-area:        footer;
            background-color: fn.color(--footer --bg);
        }

        @include iro.bem-elem('thumbnail') {
            opacity: .75;

            &:hover {
                opacity: 1;
            }

            @include iro.bem-is('selected') {
                opacity:    1;
                box-shadow: 0 0 0 fn.dim(--thumbnail --selected) fn.color(--thumbnail --selected);
            }
        }

        @include iro.bem-elem('thumbnail-img') {
            display:         block;
            width:           fn.dim(--thumbnail --size);
            height:          fn.dim(--thumbnail --size);
            object-fit:      cover;
            object-position: center center;
        }

        @include iro.bem-elem('close-btn') {
            flex:      0 0 auto;
            margin:    calc(-.5 * fn.dim(--pad)) calc(-.5 * fn.dim(--pad)) 0 auto;
            font-size: fn.dim(--close-button --font-size);
        }

        @include iro.bem-elem('nav-btn') {
            position:   relative;
            align-self: center;
            overflow:   visible;
            font-size:  fn.dim(--nav-button --font-size);

            &::after {
                content:   '';
                display:   block;
                position:  absolute;
                top:       50%;
                left:      50%;
                width:     fn.dim(--nav-button --width);
                height:    fn.dim(--nav-button --height);
                transform: translate(-50%, -50%);
            }

            @include iro.bem-modifier('prev') {
                grid-area:    prev;
                margin-right: calc(-1 * fn.dim(--pad));
                margin-left:  calc(.5 * fn.dim(--pad));
            }
    
            @include iro.bem-modifier('next') {
                grid-area:    next;
                margin-right: calc(.5 * fn.dim(--pad));
                margin-left:  calc(-1 * fn.dim(--pad));
            }
        }
    }
}