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

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

    @include iro.props-store((
        --dims: (
            --thumbnail: (
                --size: fn.global-dim(--size --600),
            ),
            --nav-btn: (
                --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),
            ),
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display:               grid;
        grid-template-rows:    auto minmax(0, 1fr) auto;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:   'header close' 'content content' 'footer footer';
        gap:                   fn.dim(--spacing);
        position:              relative;
        height:                100%;

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

        @include iro.bem-elem('header') {
            grid-area:     header;
            overflow:      hidden;
            text-overflow: ellipsis;
            white-space:   nowrap;
        }

        @include iro.bem-elem('img') {
            box-sizing: border-box;
            grid-area:  content;
            max-width:  100%;
            max-height: 100%;
            margin:     auto;
            padding:    0 calc(fn.dim(--button --font-size) + 2 * fn.foreign-dim(--action-button, --pad-x) + 2px);
        }

        @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') {
            grid-area: close;
            font-size: fn.dim(--button --font-size);
        }

        @include iro.bem-elem('prev-btn', 'next-btn') {
            position:  absolute;
            top:       50%;
            overflow:  visible;
            transform: translate(0, -50%);
            font-size: fn.dim(--button --font-size);

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

        @include iro.bem-elem('prev-btn') {
            left: 0;
        }

        @include iro.bem-elem('next-btn') {
            right: 0;
        }
    }
}