summaryrefslogtreecommitdiffstats
path: root/src/layouts/_container.scss
blob: efe52037e158b6101c5b89ec29a2dca8c048c55c (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
@use 'iro-sass/src/index' as iro;
@use 'include-media/dist/include-media' as media;

@include iro.props-namespace('container') {
    @include iro.props-store((
        --dims: (
            --content-width:     iro.fn-px-to-rem(700px),
            --sm-content-width:  iro.fn-px-to-rem(360px),
            --padding-x:         3rem,
            --padding-y:         3rem,
            --in-page-spacing-y: iro.props-get(--dims --spacing --y --xl, $global: true),
        )
    ));

    @include iro.bem-layout(iro.props-namespace()) {
        overflow: hidden;

        @include iro.bem-elem('inner') {
            margin-top:    calc(-1 * iro.props-get(--dims --spacing --y --xl, $global: true));
            margin-bottom: calc(-1 * iro.props-get(--dims --spacing --y --xl, $global: true));

            &::before,
            &::after {
                content: '';
                display: block;
                width:   0;
                height:  0;
            }

            &::before {
                margin-bottom: iro.props-get(--dims --spacing --y --xl, $global: true);
            }

            &::after {
                margin-top: iro.props-get(--dims --spacing --y --xl, $global: true);
            }
        }

        @include iro.bem-modifier('pad-x') {
            padding-right: iro.props-get(--dims --padding-x);
            padding-left:  iro.props-get(--dims --padding-x);
        }

        @include iro.bem-modifier('pad-y') {
            padding-top:    iro.props-get(--dims --padding-y);
            padding-bottom: iro.props-get(--dims --padding-y);
        }

        @include iro.bem-modifier('narrow') {
            max-width:    iro.props-get(--dims --content-width);
            margin-right: auto;
            margin-left:  auto;

            @each $breakpoint in map-keys(media.$breakpoints) {
                @include media.media('<=#{$breakpoint}') {
                    @include iro.bem-suffix('#{$breakpoint}-down') {
                        max-width:    iro.props-get(--dims --content-width);
                        margin-right: auto;
                        margin-left:  auto;
                    }
                }
            }
        }

        @include iro.bem-modifier('sm-narrow') {
            max-width:    iro.props-get(--dims --sm-content-width);
            margin-right: auto;
            margin-left:  auto;

            @each $breakpoint in map-keys(media.$breakpoints) {
                @include media.media('<=#{$breakpoint}') {
                    @include iro.bem-suffix('#{$breakpoint}-down') {
                        max-width:    iro.props-get(--dims --sm-content-width);
                        margin-right: auto;
                        margin-left:  auto;
                    }
                }
            }
        }

        @include iro.bem-modifier('themed') {
            background-color: iro.props-get(--colors --bg, $global: true);
            color:            iro.props-get(--colors --fg, $global: true);
        }

        @include iro.bem-modifier('in-page') {
            margin-top:    iro.props-get(--dims --in-page-spacing-y);
            margin-bottom: iro.props-get(--dims --in-page-spacing-y);
        }
    }
}