summaryrefslogtreecommitdiffstats
path: root/src/_props.scss
blob: 09082a347a39183ca6ac38086609023f8776f5f7 (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
@use 'sass:list';
@use 'sass:map';
@use 'sass:meta';
@use 'config';
@use 'include-media/dist/include-media' as media;
@use 'iro-sass/src/iro-sass' as iro;

@forward 'iro-sass/src/props';

@mixin materialize($ref) {
    @if meta.type-of($ref) == 'map' {
        $ref: map.values($ref);
    }

    :root {
        @include iro.props-materialize($ref, null);

        @each $breakpoint in map.keys(media.$breakpoints) {
            @include media.media('<=#{$breakpoint}') {
                @include iro.props-materialize($ref, $breakpoint);
            }
        }

        @media (prefers-color-scheme: dark) {
            @include iro.props-materialize($ref, 'dark');
        }
    }

    @each $theme-name in map.keys(config.$themes) {
        @if $theme-name != config.$theme-default {
            @include iro.bem-theme($theme-name) {
                @include iro.props-materialize($ref, null);

                @each $breakpoint in map.keys(media.$breakpoints) {
                    @include media.media('<=#{$breakpoint}') {
                        @include iro.props-materialize($ref, $breakpoint);
                    }
                }
                
                @media (prefers-color-scheme: dark) {
                    @include iro.props-materialize($ref, 'dark');
                }
            }
        }
    }
}