diff options
author | Volpeon <git@volpeon.ink> | 2024-11-17 15:51:24 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-11-17 15:51:24 +0100 |
commit | 4ef7ba48a68980c126b89bf5ba5a9ddac804f88f (patch) | |
tree | d0351997b3823d13c0cc94e717420dedecd6d65d /src | |
parent | Fix heading color (diff) | |
download | iro-design-4ef7ba48a68980c126b89bf5ba5a9ddac804f88f.tar.gz iro-design-4ef7ba48a68980c126b89bf5ba5a9ddac804f88f.tar.bz2 iro-design-4ef7ba48a68980c126b89bf5ba5a9ddac804f88f.zip |
Add navbar
Diffstat (limited to 'src')
-rw-r--r-- | src/_iro-design.scss | 1 | ||||
-rw-r--r-- | src/objects/_action-button.vars.scss | 8 | ||||
-rw-r--r-- | src/objects/_navbar.scss | 165 | ||||
-rw-r--r-- | src/objects/_navbar.vars.scss | 83 |
4 files changed, 253 insertions, 4 deletions
diff --git a/src/_iro-design.scss b/src/_iro-design.scss index ac07846..6088344 100644 --- a/src/_iro-design.scss +++ b/src/_iro-design.scss | |||
@@ -56,6 +56,7 @@ $breakpoints: ( | |||
56 | @forward 'objects/icon' as o-icon--*; | 56 | @forward 'objects/icon' as o-icon--*; |
57 | @forward 'objects/lightbox' as o-lightbox--*; | 57 | @forward 'objects/lightbox' as o-lightbox--*; |
58 | @forward 'objects/menu' as o-menu--*; | 58 | @forward 'objects/menu' as o-menu--*; |
59 | @forward 'objects/navbar' as o-navbar--*; | ||
59 | @forward 'objects/palette' as o-palette--*; | 60 | @forward 'objects/palette' as o-palette--*; |
60 | @forward 'objects/popover' as o-popover--*; | 61 | @forward 'objects/popover' as o-popover--*; |
61 | @forward 'objects/radio' as o-radio--*; | 62 | @forward 'objects/radio' as o-radio--*; |
diff --git a/src/objects/_action-button.vars.scss b/src/objects/_action-button.vars.scss index 9de985a..8c3d510 100644 --- a/src/objects/_action-button.vars.scss +++ b/src/objects/_action-button.vars.scss | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | $line-height: props.def(--o-action-button--line-height, 1.4) !default; | 6 | $line-height: props.def(--o-action-button--line-height, 1.4) !default; |
7 | $pad-i: props.def(--o-action-button--pad-i, props.get(core.$size--150)) !default; | 7 | $pad-i: props.def(--o-action-button--pad-i, props.get(core.$size--150)) !default; |
8 | $pad-i-label: props.def(--o-button--pad-i-label, props.get(core.$size--50)) !default; | 8 | $pad-i-label: props.def(--o-action-button--pad-i-label, props.get(core.$size--50)) !default; |
9 | $pad-i-pill: props.def(--o-action-button--pad-i-pill, props.get(core.$size--200)) !default; | 9 | $pad-i-pill: props.def(--o-action-button--pad-i-pill, props.get(core.$size--200)) !default; |
10 | $pad-b: props.def(--o-action-button--pad-b, props.get(core.$size--85)) !default; | 10 | $pad-b: props.def(--o-action-button--pad-b, props.get(core.$size--85)) !default; |
11 | $border-width: props.def(--o-action-button--border-width, props.get(core.$border-width--thin)) !default; | 11 | $border-width: props.def(--o-action-button--border-width, props.get(core.$border-width--thin)) !default; |
@@ -13,19 +13,19 @@ $rounding: props.def(--o-action-button--rounding, props.get(core.$rounding)) | |||
13 | $font-size: props.def(--o-action-button--font-size, props.get(core.$font-size--100)) !default; | 13 | $font-size: props.def(--o-action-button--font-size, props.get(core.$font-size--100)) !default; |
14 | 14 | ||
15 | $pad-i--sm: props.def(--o-action-button--sm--pad-i, props.get(core.$size--100)) !default; | 15 | $pad-i--sm: props.def(--o-action-button--sm--pad-i, props.get(core.$size--100)) !default; |
16 | $pad-i-label--sm: props.def(--o-button--sm--pad-i-label, props.get(core.$size--25)) !default; | 16 | $pad-i-label--sm: props.def(--o-action-button--sm--pad-i-label, props.get(core.$size--25)) !default; |
17 | $pad-i-pill--sm: props.def(--o-action-button--sm--pad-i-pill, props.get(core.$size--150)) !default; | 17 | $pad-i-pill--sm: props.def(--o-action-button--sm--pad-i-pill, props.get(core.$size--150)) !default; |
18 | $pad-b--sm: props.def(--o-action-button--sm--pad-b, props.get(core.$size--40)) !default; | 18 | $pad-b--sm: props.def(--o-action-button--sm--pad-b, props.get(core.$size--40)) !default; |
19 | $font-size--sm: props.def(--o-action-button--sm--font-size, props.get(core.$font-size--75)) !default; | 19 | $font-size--sm: props.def(--o-action-button--sm--font-size, props.get(core.$font-size--75)) !default; |
20 | 20 | ||
21 | $pad-i--lg: props.def(--o-action-button--lg--pad-i, props.get(core.$size--175)) !default; | 21 | $pad-i--lg: props.def(--o-action-button--lg--pad-i, props.get(core.$size--175)) !default; |
22 | $pad-i-label--lg: props.def(--o-button--lg--pad-i-label, props.get(core.$size--100)) !default; | 22 | $pad-i-label--lg: props.def(--o-action-button--lg--pad-i-label, props.get(core.$size--100)) !default; |
23 | $pad-i-pill--lg: props.def(--o-action-button--lg--pad-i-pill, props.get(core.$size--250)) !default; | 23 | $pad-i-pill--lg: props.def(--o-action-button--lg--pad-i-pill, props.get(core.$size--250)) !default; |
24 | $pad-b--lg: props.def(--o-action-button--lg--pad-b, props.get(core.$size--115)) !default; | 24 | $pad-b--lg: props.def(--o-action-button--lg--pad-b, props.get(core.$size--115)) !default; |
25 | $font-size--lg: props.def(--o-action-button--lg--font-size, props.get(core.$font-size--150)) !default; | 25 | $font-size--lg: props.def(--o-action-button--lg--font-size, props.get(core.$font-size--150)) !default; |
26 | 26 | ||
27 | $pad-i--xl: props.def(--o-action-button--xl--pad-i, props.get(core.$size--225)) !default; | 27 | $pad-i--xl: props.def(--o-action-button--xl--pad-i, props.get(core.$size--225)) !default; |
28 | $pad-i-label--xl: props.def(--o-button--xl--pad-i-label, props.get(core.$size--150)) !default; | 28 | $pad-i-label--xl: props.def(--o-action-button--xl--pad-i-label, props.get(core.$size--150)) !default; |
29 | $pad-i-pill--xl: props.def(--o-action-button--xl--pad-i-pill, props.get(core.$size--300)) !default; | 29 | $pad-i-pill--xl: props.def(--o-action-button--xl--pad-i-pill, props.get(core.$size--300)) !default; |
30 | $pad-b--xl: props.def(--o-action-button--xl--pad-b, props.get(core.$size--150)) !default; | 30 | $pad-b--xl: props.def(--o-action-button--xl--pad-b, props.get(core.$size--150)) !default; |
31 | $font-size--xl: props.def(--o-action-button--xl--font-size, props.get(core.$font-size--200)) !default; | 31 | $font-size--xl: props.def(--o-action-button--xl--font-size, props.get(core.$font-size--200)) !default; |
diff --git a/src/objects/_navbar.scss b/src/objects/_navbar.scss new file mode 100644 index 0000000..16cf804 --- /dev/null +++ b/src/objects/_navbar.scss | |||
@@ -0,0 +1,165 @@ | |||
1 | @use 'sass:map'; | ||
2 | @use 'sass:meta'; | ||
3 | @use 'sass:string'; | ||
4 | @use 'iro-sass/src/bem'; | ||
5 | @use 'iro-sass/src/props'; | ||
6 | @use '../props' as *; | ||
7 | |||
8 | @forward 'navbar.vars'; | ||
9 | @use 'navbar.vars' as vars; | ||
10 | |||
11 | @mixin styles { | ||
12 | @include materialize-at-root(meta.module-variables('vars')); | ||
13 | |||
14 | @include bem.object('navbar') { | ||
15 | display: flex; | ||
16 | block-size: props.get(vars.$block-size); | ||
17 | |||
18 | @include bem.modifier('adapt') { | ||
19 | block-size: 100%; | ||
20 | } | ||
21 | |||
22 | @include bem.elem('item-label') { | ||
23 | position: relative; | ||
24 | padding-block: props.get(vars.$item--pad-b); | ||
25 | padding-inline: props.get(vars.$item--pad-i); | ||
26 | font-size: props.get(vars.$item--font-size); | ||
27 | color: currentColor; | ||
28 | border-radius: 100em; | ||
29 | |||
30 | &::after { | ||
31 | position: absolute; | ||
32 | inset: calc(-1 * props.get(vars.$key-focus--border-offset)); | ||
33 | z-index: 1; | ||
34 | display: none; | ||
35 | pointer-events: none; | ||
36 | content: ''; | ||
37 | border-radius: 100em; | ||
38 | outline: props.get(vars.$default-theme, --key-focus, --border) solid props.get(vars.$key-focus--border-width); | ||
39 | box-shadow: | ||
40 | 0 | ||
41 | 0 | ||
42 | 0 | ||
43 | calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width)) | ||
44 | props.get(vars.$default-theme, --key-focus, --outline); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | @include bem.elem('item') { | ||
49 | display: flex; | ||
50 | flex-direction: column; | ||
51 | align-items: center; | ||
52 | justify-content: center; | ||
53 | inline-size: 100%; | ||
54 | padding-inline: calc(.5 * props.get(vars.$spacing)); | ||
55 | font-weight: 500; | ||
56 | color: props.get(vars.$default-theme, --disabled, --label-color); | ||
57 | |||
58 | &:link, | ||
59 | &:visited, | ||
60 | &:enabled { | ||
61 | color: props.get(vars.$default-theme, --label-color); | ||
62 | |||
63 | &:hover, | ||
64 | &:focus-visible { | ||
65 | color: props.get(vars.$default-theme, --hover, --label-color); | ||
66 | |||
67 | @include bem.elem('item-label') { | ||
68 | background-color: props.get(vars.$default-theme, --hover, --bg-color); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | &:focus-visible { | ||
73 | @include bem.elem('item-label') { | ||
74 | &::after { | ||
75 | display: block; | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | |||
80 | &:active { | ||
81 | color: props.get(vars.$default-theme, --active, --label-color); | ||
82 | |||
83 | @include bem.elem('item-label') { | ||
84 | background-color: props.get(vars.$default-theme, --active, --bg-color); | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | |||
89 | @include bem.is('selected') { | ||
90 | font-weight: bold; | ||
91 | color: props.get(vars.$default-theme, --selected, --disabled, --label-color); | ||
92 | |||
93 | @include bem.elem('item-label') { | ||
94 | background-color: props.get(vars.$default-theme, --selected, --disabled, --bg-color); | ||
95 | } | ||
96 | |||
97 | &:link, | ||
98 | &:visited, | ||
99 | &:enabled { | ||
100 | color: props.get(vars.$default-theme, --selected, --label-color); | ||
101 | |||
102 | @include bem.elem('item-label') { | ||
103 | background-color: props.get(vars.$default-theme, --selected, --bg-color); | ||
104 | } | ||
105 | |||
106 | &:hover, | ||
107 | &:focus-visible { | ||
108 | color: props.get(vars.$default-theme, --selected, --hover, --label-color); | ||
109 | |||
110 | @include bem.elem('item-label') { | ||
111 | background-color: props.get(vars.$default-theme, --selected, --hover, --bg-color); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | &:active { | ||
116 | color: props.get(vars.$default-theme, --selected, --active, --label-color); | ||
117 | |||
118 | @include bem.elem('item-label') { | ||
119 | background-color: props.get(vars.$default-theme, --selected, --active, --bg-color); | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | @include bem.modifier('quiet') { | ||
127 | @include bem.elem('item') { | ||
128 | @include bem.is('selected') { | ||
129 | color: props.get(vars.$default-theme, --quiet, --selected, --disabled, --label-color); | ||
130 | |||
131 | @include bem.elem('item-label') { | ||
132 | background-color: props.get(vars.$default-theme, --quiet, --selected, --disabled, --bg-color); | ||
133 | } | ||
134 | |||
135 | &:link, | ||
136 | &:visited, | ||
137 | &:enabled { | ||
138 | color: props.get(vars.$default-theme, --quiet, --selected, --label-color); | ||
139 | |||
140 | @include bem.elem('item-label') { | ||
141 | background-color: props.get(vars.$default-theme, --quiet, --selected, --bg-color); | ||
142 | } | ||
143 | |||
144 | &:hover, | ||
145 | &:focus-visible { | ||
146 | color: props.get(vars.$default-theme, --quiet, --selected, --hover, --label-color); | ||
147 | |||
148 | @include bem.elem('item-label') { | ||
149 | background-color: props.get(vars.$default-theme, --quiet, --selected, --hover, --bg-color); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | &:active { | ||
154 | color: props.get(vars.$default-theme, --quiet, --selected, --active, --label-color); | ||
155 | |||
156 | @include bem.elem('item-label') { | ||
157 | background-color: props.get(vars.$default-theme, --quiet, --selected, --active, --bg-color); | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | } | ||
diff --git a/src/objects/_navbar.vars.scss b/src/objects/_navbar.vars.scss new file mode 100644 index 0000000..dfd683a --- /dev/null +++ b/src/objects/_navbar.vars.scss | |||
@@ -0,0 +1,83 @@ | |||
1 | @use 'sass:map'; | ||
2 | @use 'sass:string'; | ||
3 | @use 'iro-sass/src/props'; | ||
4 | @use '../core.vars' as core; | ||
5 | |||
6 | $block-size: props.def(--o-navbar--block-size, props.get(core.$size--700)) !default; | ||
7 | $spacing: props.def(--o-tabs--spacing, props.get(core.$size--400)) !default; | ||
8 | |||
9 | $item--pad-i: props.def(--o-navbar--item--pad-i, props.get(core.$size--175)) !default; | ||
10 | $item--pad-b: props.def(--o-navbar--item--pad-b, props.get(core.$size--40)) !default; | ||
11 | $item--font-size: props.def(--o-navbar--item--font-size, props.get(core.$font-size--75)) !default; | ||
12 | |||
13 | $key-focus--border-width: props.def(--o-navbar--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; | ||
14 | $key-focus--border-offset: props.def(--o-navbar--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; | ||
15 | $key-focus--outline-width: props.def(--o-navbar--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default; | ||
16 | |||
17 | $default-theme-override: () !default; | ||
18 | $default-theme: map.deep-merge(( | ||
19 | --label-color: props.get(core.$theme, --text), | ||
20 | |||
21 | --hover: ( | ||
22 | --bg-color: props.get(core.$theme, --border-mute), | ||
23 | --label-color: props.get(core.$theme, --heading), | ||
24 | ), | ||
25 | |||
26 | --active: ( | ||
27 | --bg-color: props.get(core.$theme, --border), | ||
28 | --label-color: props.get(core.$theme, --heading), | ||
29 | ), | ||
30 | |||
31 | --disabled: ( | ||
32 | --label-color: props.get(core.$theme, --border-strong), | ||
33 | ), | ||
34 | |||
35 | --key-focus: ( | ||
36 | --label: props.get(core.$theme, --focus, --text), | ||
37 | --border: props.get(core.$theme, --focus, --border), | ||
38 | --outline: props.get(core.$theme, --focus, --outline), | ||
39 | ), | ||
40 | |||
41 | --selected: ( | ||
42 | --bg-color: props.get(core.$theme, --heading), | ||
43 | --label-color: props.get(core.$theme, --base, --50), | ||
44 | |||
45 | --hover: ( | ||
46 | --bg-color: props.get(core.$theme, --text), | ||
47 | --label-color: props.get(core.$theme, --base, --50), | ||
48 | ), | ||
49 | |||
50 | --active: ( | ||
51 | --bg-color: props.get(core.$theme, --text-mute), | ||
52 | --label-color: props.get(core.$theme, --base, --50), | ||
53 | ), | ||
54 | |||
55 | --disabled: ( | ||
56 | --bg-color: props.get(core.$theme, --border-mute), | ||
57 | --label-color: props.get(core.$theme, --border-strong), | ||
58 | ), | ||
59 | ), | ||
60 | |||
61 | --quiet: ( | ||
62 | --selected: ( | ||
63 | --bg-color: props.get(core.$theme, --accent, --200), | ||
64 | --label-color: props.get(core.$theme, --accent, --1100), | ||
65 | |||
66 | --hover: ( | ||
67 | --bg-color: props.get(core.$theme, --accent, --300), | ||
68 | --label-color: props.get(core.$theme, --accent, --1200), | ||
69 | ), | ||
70 | |||
71 | --active: ( | ||
72 | --bg-color: props.get(core.$theme, --accent, --400), | ||
73 | --label-color: props.get(core.$theme, --accent, --1300), | ||
74 | ), | ||
75 | |||
76 | --disabled: ( | ||
77 | --bg-color: props.get(core.$theme, --accent, --200), | ||
78 | --label-color: props.get(core.$theme, --accent, --800), | ||
79 | ), | ||
80 | ) | ||
81 | ) | ||
82 | ), $default-theme-override) !default; | ||
83 | $default-theme: props.def(--o-navbar, $default-theme, 'color'); | ||