summaryrefslogtreecommitdiffstats
path: root/assets/css/components/_lightbox.scss
blob: f497a5e293588edeb56281494e4968c2d9d6105f (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
@include namespace('lightbox') {
    @include store((
        --colors: (
            --bg: prop(--colors --bg-hi, $global: true),
            --button: (
                --idle:  prop(--colors --fg-hi, $global: true),
                --hover: prop(--colors --fg-lo, $global: true),
                --bg:    prop(--colors --bg-hi, $global: true),
            )
        ),
        --dims: (
            --pad: 1rem,
        ),
    ));

    @include component(namespace()) {
        display:         flex;
        visibility:      hidden;
        position:        fixed;
        z-index:         5000;
        top:             0;
        left:            0;
        box-sizing:      border-box;
        flex-direction:  column;
        align-items:     center;
        justify-content: center;
        width:           100%;
        height:          100%;
        padding-bottom:  3vh;
        transition:      opacity .2s, visibility .2s;
        opacity:         0;

        @include element('bg') {
            position:         absolute;
            z-index:          -10;
            top:              0;
            left:             0;
            width:            100%;
            height:           100%;
            opacity:          .85;
            background-color: prop(--colors --bg);
        }

        @include is('shown') {
            visibility: visible;
            transition: opacity .2s, visibility 0 .2s;
            opacity:    1;
        }

        @include element('infobar') {
            display:     flex;
            box-sizing:  border-box;
            flex:        0 0 auto;
            align-items: center;
            width:       100%;
            padding:     0 prop(--dims --pad);
        }

        @include element('img') {
            max-width:     100%;
            min-height:    0;
            max-height:    100%;
            margin-top:    auto;
            margin-bottom: auto;
        }

        @include element('close', 'prev', 'next') {
            margin:           0;
            transition:       color .2s;
            border:           0;
            background-color: transparent;
            color:            currentColor;

            &:hover {
                color: prop(--colors --button --hover);
            }
        }

        @include element('close') {
            margin:      0 calc(-1 * #{prop(--dims --pad)}) 0 auto;
            padding:     prop(--dims --pad);
            font-size:   1.5em;
        }

        @include element('prev', 'next') {
            position:            absolute;
            top:                 50%;
            padding:             2rem .5rem;
            transform:           translate(0, -50%);
            font-size:           3em;
            --icon-stroke-width: .75px;

            &::before {
                content:          '';
                display:          block;
                position:         absolute;
                z-index:          -1;
                top:              50%;
                left:             50%;
                width:            1.2em;
                height:           1.2em;
                transform:        translate(-50%, -50%);
                opacity:          .25;
                background-color: prop(--colors --button --bg);
            }
        }

        @include element('prev') {
            left: 0;
        }

        @include element('next') {
            right: 0;
        }
    }
}