summaryrefslogtreecommitdiffstats
path: root/assets/css/components/_lightbox.scss
blob: b23943ad7ab90e6c451b2e7b369464449bc381e1 (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
@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),
            )
        ),
        --dims: (
            --col-width: 17em
        )
    ));

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

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

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

        @include element('img') {
            max-width:  100%;
            max-height: 100%;
        }

        @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') {
            position:  absolute;
            top:       0;
            right:     0;
            padding:   1rem;
            font-size: 1.5em;
        }

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

            > * {
                stroke-width: .75px;
            }
        }

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

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