summaryrefslogtreecommitdiffstats
path: root/src/layouts/_split-view.scss
blob: a76f6e80437dd4c77b4867f85b5f5a497c3b1732 (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
@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 'split-view.vars';
@use 'split-view.vars' as vars;

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

    @include bem.layout('split-view') {
        display:     flex;
        gap:         props.get(vars.$col-gap);
        align-items: start;

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

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

            @include bem.modifier('side-25') {
                flex:            0 0 auto;
                inline-size:     25%;
                min-inline-size: props.get(vars.$panel--side-25--min);
            }

            @include bem.modifier('sticky') {
                position:          sticky;
                inset-block-start: 0;
            }

            @include bem.modifier('sticky-400') {
                position:          sticky;
                inset-block-start: props.get(vars.$panel--sticky-400--inset);
            }
        }

        @include bem.elem('content') {
            inline-size: 100%;
        }

        @include media.media('<=md') {
            flex-direction: column;
            gap:            props.get(vars.$row-gap);
            align-items:    stretch;

            @include bem.modifier('wrap-reverse') {
                flex-direction: column-reverse;
            }

            @include bem.elem('panel') {
                flex: 1 1 auto;

                @include bem.modifier('side-25') {
                    inline-size:     auto;
                    min-inline-size: 0;
                }

                @include bem.modifier('sticky', 'sticky-400') {
                    position: static;
                }
            }
        }
    }
}