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

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

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

    @include bem.layout('card-list') {
        display:        flex;
        flex-direction: column;
        gap:            props.get(vars.$row-gap);
        padding:        0;
        margin:         0;
        list-style:     none;

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

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

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

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

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

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

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

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

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

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

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

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