summaryrefslogtreecommitdiffstats
path: root/src/layouts/_card-list.scss
blob: 1aea7bc6584103445530c5579740a524b8d33a64 (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
@use 'sass:meta';
@use 'include-media/dist/include-media' as media;
@use 'iro-sass/src/iro-sass' as iro;
@use '../props';

@forward 'card-list.vars';
@use 'card-list.vars' as vars;

@mixin styles {
    @include props.materialize(meta.module-variables('vars'));

    @include iro.bem-layout('card-list') {
        display:        flex;
        flex-direction: column;
        gap:            props.get(vars.$row-gap) props.get(vars.$col-gap);

        @include iro.bem-modifier('grid') {
            display:               grid;
            grid-template-columns: repeat(auto-fill, minmax(props.get(vars.$grid--col-width), 1fr));
            gap:                   props.get(vars.$grid--col-gap);

            @include iro.bem-modifier('quiet') {
                row-gap: props.get(vars.$grid--row-gap);
            }
        }

        @include iro.bem-modifier('masonry') {
            display:    block;
            columns:    auto props.get(vars.$masonry--col-width);
            column-gap: props.get(vars.$masonry--col-gap);

            @include iro.bem-elem('card') {
                margin-block-end: props.get(vars.$masonry--col-gap);
                break-inside:     avoid;
            }

            @include iro.bem-modifier('quiet') {
                @include iro.bem-elem('card') {
                    margin-block-end: props.get(vars.$masonry--row-gap);
                }
            }
        }

        @include iro.bem-modifier('masonry-h') {
            flex-flow: row wrap;
            gap:       props.get(vars.$masonry-h--col-gap);

            &::after {
                display:     block;
                flex:        1 0 auto;
                inline-size: props.get(vars.$masonry-h--row-height);
                block-size:  0;
                content:     '';
            }

            @include iro.bem-elem('card') {
                flex:            1 0 auto;
                max-inline-size: 100%;
            }

            @include iro.bem-elem('card-image') {
                block-size: props.get(vars.$masonry-h--row-height);
            }

            @include iro.bem-modifier('quiet') {
                row-gap: props.get(vars.$masonry-h--row-gap);
            }
        }

        @include iro.bem-modifier('aspect-5\\/4') {
            @include iro.bem-elem('card-image') {
                aspect-ratio: 5 / 4;
            }
        }
    }
}