diff options
author | Volpeon <git@volpeon.ink> | 2024-10-18 18:08:24 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-10-18 18:08:24 +0200 |
commit | 365c56edcc36b5b92902bac01ce44b43d01e8685 (patch) | |
tree | 644611792591a76e605068d0c9e230fad6a633e7 /src/objects/_menu.scss | |
parent | Revamped variable management (diff) | |
download | iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.tar.gz iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.tar.bz2 iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.zip |
Refactoring
Diffstat (limited to 'src/objects/_menu.scss')
-rw-r--r-- | src/objects/_menu.scss | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/src/objects/_menu.scss b/src/objects/_menu.scss new file mode 100644 index 0000000..12e9755 --- /dev/null +++ b/src/objects/_menu.scss | |||
@@ -0,0 +1,137 @@ | |||
1 | /* stylelint-disable length-zero-no-unit */ | ||
2 | |||
3 | @use 'iro-sass/src/iro-sass' as iro; | ||
4 | @use '../functions' as fn; | ||
5 | |||
6 | @use './icon'; | ||
7 | |||
8 | @include iro.props-namespace('menu') { | ||
9 | @include iro.props-store(( | ||
10 | --dims: ( | ||
11 | --spacing: 0em, | ||
12 | --header: ( | ||
13 | --font-size: fn.global-dim(--font-size --50), | ||
14 | ), | ||
15 | --separator: fn.global-dim(--size --100), | ||
16 | --item: ( | ||
17 | --pad-i: fn.global-dim(--size --150), | ||
18 | --pad-b: fn.global-dim(--size --100), | ||
19 | --rounding: 0em, | ||
20 | |||
21 | --key-focus: ( | ||
22 | --border: fn.global-dim(--key-focus --border), | ||
23 | --border-offset: fn.global-dim(--key-focus --border-offset), | ||
24 | --outline: fn.global-dim(--key-focus --outline), | ||
25 | ), | ||
26 | ), | ||
27 | ), | ||
28 | --colors: ( | ||
29 | --separator: fn.global-color(--border), | ||
30 | --header: ( | ||
31 | --label: fn.global-color(--heading), | ||
32 | ), | ||
33 | --item: ( | ||
34 | --hover: ( | ||
35 | --bg: fn.global-color(--border-mute), | ||
36 | --label: fn.global-color(--heading), | ||
37 | ), | ||
38 | --active: ( | ||
39 | --bg: fn.global-color(--border), | ||
40 | --label: fn.global-color(--heading), | ||
41 | ), | ||
42 | --disabled: ( | ||
43 | --label: fn.global-color(--text-disabled), | ||
44 | ), | ||
45 | --key-focus: ( | ||
46 | --border: fn.global-color(--focus --border), | ||
47 | --outline: fn.global-color(--focus --outline), | ||
48 | ), | ||
49 | ), | ||
50 | ), | ||
51 | )); | ||
52 | |||
53 | @include iro.bem-object(iro.props-namespace()) { | ||
54 | display: flex; | ||
55 | flex-direction: column; | ||
56 | gap: fn.dim(--spacing); | ||
57 | |||
58 | @include iro.bem-elem('header') { | ||
59 | padding-block: fn.dim(--item --pad-b); | ||
60 | padding-inline: fn.dim(--item --pad-i); | ||
61 | font-size: fn.dim(--header --font-size); | ||
62 | font-weight: 500; | ||
63 | color: fn.color(--header --label); | ||
64 | text-transform: uppercase; | ||
65 | letter-spacing: .5px; | ||
66 | |||
67 | @include iro.bem-next-twin-elem { | ||
68 | margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | @include iro.bem-elem('item') { | ||
73 | padding-block: fn.dim(--item --pad-b); | ||
74 | padding-inline: fn.dim(--item --pad-i); | ||
75 | margin: calc(-1 * fn.dim(--item --key-focus --outline)); | ||
76 | color: fn.color(--item --disabled --label); | ||
77 | background-clip: padding-box; | ||
78 | border: fn.dim(--item --key-focus --outline) solid transparent; | ||
79 | border-radius: calc(fn.dim(--item --rounding) + fn.dim(--item --key-focus --outline)); | ||
80 | |||
81 | &:link, | ||
82 | &:visited, | ||
83 | &:enabled { | ||
84 | color: currentColor; | ||
85 | |||
86 | @include iro.bem-multi('&:hover, &:focus-visible', 'is' 'selected') { | ||
87 | color: fn.color(--item --hover --label); | ||
88 | background-color: fn.color(--item --hover --bg); | ||
89 | } | ||
90 | |||
91 | &:active { | ||
92 | color: fn.color(--item --active --label); | ||
93 | background-color: fn.color(--item --active --bg); | ||
94 | } | ||
95 | |||
96 | &:focus-visible { | ||
97 | outline: fn.color(--item --key-focus --border) solid fn.dim(--item --key-focus --border); | ||
98 | box-shadow: 0 0 0 calc(fn.dim(--item --key-focus --border) + fn.dim(--item --key-focus --outline)) fn.color(--item --key-focus --outline); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | @include iro.bem-next-elem('header') { | ||
103 | margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | @include iro.bem-elem('header') { | ||
108 | &:link, | ||
109 | &:visited, | ||
110 | &:enabled { | ||
111 | color: fn.color(--header --label); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | @include iro.bem-elem('separator') { | ||
116 | block-size: 1px; | ||
117 | margin-block: fn.dim(--separator); | ||
118 | margin-inline: fn.dim(--item --pad-i); | ||
119 | background-color: fn.color(--separator); | ||
120 | } | ||
121 | |||
122 | @include iro.bem-elem('slot') { | ||
123 | padding-block: fn.dim(--item --pad-b); | ||
124 | padding-inline: fn.dim(--item --pad-i); | ||
125 | } | ||
126 | |||
127 | @include iro.bem-elem('icon-slot') { | ||
128 | display: flex; | ||
129 | justify-content: center; | ||
130 | inline-size: fn.foreign-dim(--icon, --size); | ||
131 | } | ||
132 | |||
133 | @include iro.bem-modifier('pull') { | ||
134 | margin: calc(-1 * fn.dim(--item --pad-i)); | ||
135 | } | ||
136 | } | ||
137 | } | ||