summaryrefslogtreecommitdiffstats
path: root/src/layouts/_button-group.scss
blob: b0a3c8e3e120332be50b0c1f7c1c73e47ed7a776 (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
@use 'sass:meta';
@use 'iro-sass/src/bem';
@use 'iro-sass/src/props';
@use '../props' as *;

@forward 'button-group.vars';
@use 'button-group.vars' as vars;
@use '../objects/action-button.vars' as action-button;

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

    @include bem.layout('button-group') {
        display:   inline-flex;
        flex-wrap: wrap;
        gap:       props.get(vars.$gap);

        @each $mod, $size in vars.$sizes {
            @include bem.modifier($mod) {
                gap: props.get($size);
            }
        }

        @include bem.modifier('align-block') {
            margin-inline: calc(-1 * props.get(action-button.$pad-i) - props.get(action-button.$border-width));

            @include bem.modifier('pill') {
                margin-inline: calc(-1 * props.get(action-button.$pad-i-pill) - props.get(action-button.$border-width));
            }

            @include bem.modifier('icon') {
                margin-inline: calc(-1 * props.get(action-button.$pad-b) - props.get(action-button.$border-width) - .5em * (props.get(action-button.$line-height) - 1));
            }

            @each $mod, $pad-i, $pad-i-label, $pad-i-pill, $pad-b, $font-size in action-button.$fixed-sizes {
                @include bem.modifier('action-#{$mod}') {
                    margin-inline: calc(-1 * props.get($pad-i) - props.get(action-button.$border-width));
    
                    @include bem.modifier('pill') {
                        margin-inline: calc(-1 * props.get($pad-i-pill) - props.get(action-button.$border-width));
                    }

                    @include bem.modifier('icon') {
                        margin-inline: calc(-1 * props.get($pad-b) - props.get(action-button.$border-width) - .5em * (props.get(action-button.$line-height) - 1));
                    }
                }
            }
        }
    }
}