summaryrefslogtreecommitdiffstats
path: root/src/objects/_menu.scss
blob: fae3207cd0536d72aadd0dd4fa1ea446fb49c16c (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
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('menu') {
    @include iro.props-store((
        --dims: (
            --spacing: fn.global-dim(--size --25),
            --header: (
                --font-size: fn.global-dim(--font-size --50),
            ),
            --separator: fn.global-dim(--size --150),
            --item: (
                --pad-x:    fn.global-dim(--size --150),
                --pad-y:    fn.global-dim(--size --100),
                --rounding: 3px,
            ),
        ),
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --header: (
                --label:  fn.global-color(--fg-hi),
            ),
            --item: (
                --hover: (
                    --bg:    fn.global-color(--obj-hi),
                    --label: fn.global-color(--fg-lo),
                ),
                --disabled: (
                    --label: fn.global-color(--fg-hi3),
                ),
                --key-focus: (
                    --border: fn.global-color(--focus --fill),
                    --shadow: fn.global-color(--focus --shadow),
                ),
            ),
        ),
    ), 'colors');

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

        @include iro.bem-elem('header') {
            padding:        fn.dim(--item --pad-y) fn.dim(--item --pad-x);
            color:          fn.color(--header --label);
            font-size:      fn.dim(--header --font-size);
            font-weight:    500;
            letter-spacing: .5px;
            text-transform: uppercase;
        }

        @include iro.bem-elem('item') {
            padding:       calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px);
            border:        2px solid transparent;
            border-radius: fn.dim(--item --rounding);
            color:         fn.color(--item --disabled --label);

            &:link,
            &:visited,
            &:enabled {
                color: currentColor;

                @include iro.bem-multi('&:hover, &:active', 'is' 'selected') {
                    background-color: fn.color(--item --hover --bg);
                    color:            fn.color(--item --hover --label);
                }
    
                @include iro.bem-at-theme('keyboard') {
                    &:focus {
                        border-radius:    calc(fn.dim(--item --rounding) - 1px);
                        border-color:     fn.color(--item --key-focus --border);
                        background-color: fn.color(--item --hover --bg);
                        box-shadow:       fn.color(--item --key-focus --shadow);
                        color:            fn.color(--item --hover --label);
                    }
                }
            }
        }

        @include iro.bem-elem('separator') {
            height: fn.dim(--separator);
        }

        @include iro.bem-elem('icon-slot') {
            display:         flex;
            justify-content: center;
            width:           1em;
        }
    }
}