summaryrefslogtreecommitdiffstats
path: root/src/layouts/_card-list.scss
blob: 0722a88368aff39c17f999da2f287d5627a0ed1e (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
@use 'sass:meta';
@use 'include-media/dist/include-media' as media;
@use 'iro-sass/src/iro-sass' as iro;
@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 iro.bem-layout('card-list') {
        display:        flex;
        flex-direction: column;
        gap:            props.get(vars.$row-gap);

        @include iro.bem-modifier('quiet') {
            row-gap: props.get(vars.$quiet--row-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--row-gap) props.get(vars.$grid--col-gap);

            @include iro.bem-modifier('quiet') {
                row-gap: props.get(vars.$grid--quiet--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--row-gap);
                break-inside:     avoid;
            }

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

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

            @include iro.bem-modifier('no-flush') {
                &::after {
                    display:     block;
                    flex:        1 0 auto;
                    inline-size: props.get(vars.$masonry-h--row-height);
                    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--quiet--row-gap);
            }
        }

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