summaryrefslogtreecommitdiffstats
path: root/src_old/layouts/_card-list.scss
blob: 65b6a66ca6d19d10b2529ba2e2a73fed876b0f3a (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
94
95
96
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;
@use 'include-media/dist/include-media' as media;

@include iro.props-namespace('card-list') {
    @include iro.props-store((
        --dims: (
            --row-gap: fn.global-dim(--size --800),
            --col-gap: fn.global-dim(--size --400),

            --grid: (
                --row-gap:   fn.global-dim(--size --800),
                --col-gap:   fn.global-dim(--size --400),
                --col-width: fn.global-dim(--size --3200),
            ),
            --masonry: (
                --row-gap:   fn.global-dim(--size --800),
                --col-gap:   fn.global-dim(--size --400),
                --col-width: fn.global-dim(--size --3200),
            ),
            --masonry-h: (
                --row-gap:    fn.global-dim(--size --800),
                --col-gap:    fn.global-dim(--size --400),
                --row-height: fn.global-dim(--size --3200),
            )
        ),
        --colors: (
            --border: fn.global-color(--border),
        ),
    ));

    @include iro.bem-layout(iro.props-namespace()) {
        display:        flex;
        flex-direction: column;
        gap:            fn.dim(--row-gap) fn.dim(--col-gap);

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

            @include iro.bem-modifier('quiet') {
                row-gap: fn.dim(--grid --row-gap);
            }
        }

        @include iro.bem-modifier('masonry') {
            display:    block;
            columns:    auto fn.dim(--masonry --col-width);
            column-gap: fn.dim(--masonry --col-gap);

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

            @include iro.bem-modifier('quiet') {
                @include iro.bem-elem('card') {
                    margin-block-end: fn.dim(--masonry --row-gap);
                }
            }
        }

        @include iro.bem-modifier('masonry-h') {
            flex-flow: row wrap;
            gap:       fn.dim(--masonry-h --col-gap);

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

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

            @include iro.bem-elem('card-image') {
                block-size: fn.dim(--masonry-h --row-height);
            }

            @include iro.bem-modifier('quiet') {
                row-gap: fn.dim(--masonry-h --row-gap);
            }
        }

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