summaryrefslogtreecommitdiffstats
path: root/tpl/objects/lightbox.pug
blob: 02a320044789ef6e8c1298f838409b32a05d015a (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
include icon.pug

mixin lightbox(images)
    -
        let classes = {
            'o-lightbox': true,
        }
        let linksClasses = {
            's-links': true,
        }

        if (attributes.theme) {
            classes[`o-lightbox--${attributes.theme}`] = true;
            linksClasses[`s-links--${attributes.theme}`] = true;
        }

    div(class=classes)
        header.o-lightbox__header
            div(class=linksClasses)
                block
            +action-button(theme=attributes.theme pill=true quiet=true icon='x' class='o-lightbox__close-btn')
        each img, i in images
            img.o-lightbox__img(src=images[i] id='image-' + i)
            +action-button(theme=attributes.theme pill=true quiet=true icon='chevron-left' class='o-lightbox__nav-btn o-lightbox__nav-btn--prev')
            +action-button(theme=attributes.theme pill=true quiet=true icon='chevron-right' class='o-lightbox__nav-btn o-lightbox__nav-btn--next')

        img.o-lightbox__img.o-lightbox__img--default(src=images[0])
        if images.length > 1
            +action-button(theme=attributes.theme pill=true quiet=true icon='chevron-left' class='o-lightbox__nav-btn o-lightbox__nav-btn--prev')
            +action-button(theme=attributes.theme pill=true quiet=true icon='chevron-right' class='o-lightbox__nav-btn o-lightbox__nav-btn--next')
        .o-lightbox__thumbnails
            each img, i in images
                - classes = i === 0 ? 'is-selected' : ''
                a.o-lightbox__thumbnail(class=classes href='#image-' + i)
                    img.o-lightbox__thumbnail-img(src=img)
            button.o-lightbox__thumbnail
                +icon('volume-2')(class='o-lightbox__thumbnail-icon')
            button.o-lightbox__thumbnail
                +icon('video')(class='o-lightbox__thumbnail-icon')