@sofidevo/astro-dynamic-header 3.1.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +474 -38
- package/package.json +5 -4
- package/src/ChevronIcon.astro +13 -5
- package/src/HamburgerButton.astro +100 -92
- package/src/Header.astro +103 -156
- package/src/MobileNav.astro +122 -114
- package/src/MoonIcon.astro +63 -55
- package/src/NavMenu.astro +165 -273
- package/src/SunIcon.astro +23 -15
- package/src/index.ts +6 -6
- package/src/scripts/hamburger.ts +55 -0
- package/src/scripts/nav-menu.ts +119 -0
package/src/MobileNav.astro
CHANGED
|
@@ -18,7 +18,7 @@ export interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const {
|
|
21
|
-
type,
|
|
21
|
+
type = "floating",
|
|
22
22
|
mobileNav__class,
|
|
23
23
|
menuItems = [],
|
|
24
24
|
showHomeLink = true,
|
|
@@ -144,134 +144,142 @@ const pagePathname = Astro.url.pathname;
|
|
|
144
144
|
</nav>
|
|
145
145
|
|
|
146
146
|
<style>
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
/*
|
|
148
|
+
* base (resets) < components (ours) < utilities (consumer classNames).
|
|
149
|
+
* Order statement keeps it deterministic regardless of bundling order.
|
|
150
|
+
*/
|
|
151
|
+
@layer theme, base, components, utilities;
|
|
149
152
|
|
|
150
|
-
|
|
153
|
+
@layer components {
|
|
154
|
+
.mobile-header__menu {
|
|
155
|
+
display: none;
|
|
156
|
+
|
|
157
|
+
@media (width < 768px) {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
width: 104vw;
|
|
161
|
+
height: 100dvh;
|
|
162
|
+
position: fixed;
|
|
163
|
+
top: -11px;
|
|
164
|
+
left: 0;
|
|
165
|
+
background: var(--bg-color-opaque, #151515);
|
|
166
|
+
z-index: 20;
|
|
167
|
+
transition:
|
|
168
|
+
transform 0.3s ease-in-out,
|
|
169
|
+
background-color 0.3s ease;
|
|
170
|
+
transform: translateX(100%);
|
|
171
|
+
padding: 10rem 2rem 2rem;
|
|
172
|
+
color: var(--text-color, #fff);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
a {
|
|
176
|
+
color: color-mix(
|
|
177
|
+
in srgb,
|
|
178
|
+
var(--accent-color, #00ffff) 30%,
|
|
179
|
+
var(--text-color, #ffffff) 70%
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.active {
|
|
184
|
+
color: var(--accent-color, #00ffff);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.mobile-menu {
|
|
151
189
|
display: flex;
|
|
152
190
|
flex-direction: column;
|
|
153
|
-
|
|
154
|
-
height:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
z-index: 20;
|
|
160
|
-
transition:
|
|
161
|
-
transform 0.3s ease-in-out,
|
|
162
|
-
background-color 0.3s ease;
|
|
163
|
-
transform: translateX(100%);
|
|
164
|
-
padding: 10rem 2rem 2rem;
|
|
165
|
-
color: var(--text-color, #fff);
|
|
191
|
+
gap: 1rem;
|
|
192
|
+
max-height: 76dvh;
|
|
193
|
+
overflow-y: auto;
|
|
194
|
+
list-style: none;
|
|
195
|
+
padding: 0;
|
|
196
|
+
margin: 0;
|
|
166
197
|
}
|
|
167
198
|
|
|
168
|
-
a {
|
|
169
|
-
|
|
170
|
-
in srgb,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
199
|
+
.mobile-menu li a {
|
|
200
|
+
border: solid 1px
|
|
201
|
+
color-mix(in srgb, var(--accent-color, #00ffff) 15%, transparent);
|
|
202
|
+
border-radius: 4px;
|
|
203
|
+
width: 100%;
|
|
204
|
+
height: 4rem;
|
|
205
|
+
font-size: 1.5rem;
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
padding: 0 1rem;
|
|
210
|
+
text-decoration: none;
|
|
174
211
|
}
|
|
175
212
|
|
|
176
|
-
.
|
|
177
|
-
|
|
213
|
+
.mobile-details {
|
|
214
|
+
width: 100%;
|
|
215
|
+
interpolate-size: allow-keywords;
|
|
178
216
|
}
|
|
179
|
-
}
|
|
180
217
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
font-size: 1.5rem;
|
|
199
|
-
display: flex;
|
|
200
|
-
align-items: center;
|
|
201
|
-
justify-content: space-between;
|
|
202
|
-
padding: 0 1rem;
|
|
203
|
-
text-decoration: none;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.mobile-details {
|
|
207
|
-
width: 100%;
|
|
208
|
-
interpolate-size: allow-keywords;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.mobile-details summary {
|
|
212
|
-
background: linear-gradient(
|
|
213
|
-
to right,
|
|
214
|
-
color-mix(in srgb, var(--accent-color, #00ffff) 20%, transparent),
|
|
215
|
-
transparent
|
|
216
|
-
);
|
|
217
|
-
border-radius: 4px;
|
|
218
|
-
width: 100%;
|
|
219
|
-
height: 4rem;
|
|
220
|
-
font-size: 1.5rem;
|
|
221
|
-
display: flex;
|
|
222
|
-
align-items: center;
|
|
223
|
-
justify-content: space-between;
|
|
224
|
-
padding: 0 1rem;
|
|
225
|
-
cursor: pointer;
|
|
226
|
-
list-style: none;
|
|
227
|
-
}
|
|
218
|
+
.mobile-details summary {
|
|
219
|
+
background: linear-gradient(
|
|
220
|
+
to right,
|
|
221
|
+
color-mix(in srgb, var(--accent-color, #00ffff) 20%, transparent),
|
|
222
|
+
transparent
|
|
223
|
+
);
|
|
224
|
+
border-radius: 4px;
|
|
225
|
+
width: 100%;
|
|
226
|
+
height: 4rem;
|
|
227
|
+
font-size: 1.5rem;
|
|
228
|
+
display: flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
justify-content: space-between;
|
|
231
|
+
padding: 0 1rem;
|
|
232
|
+
cursor: pointer;
|
|
233
|
+
list-style: none;
|
|
234
|
+
}
|
|
228
235
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
.mobile-details::details-content {
|
|
237
|
+
transition:
|
|
238
|
+
height 0.5s ease,
|
|
239
|
+
opacity 0.5s ease,
|
|
240
|
+
content-visibility 0.5s allow-discrete;
|
|
241
|
+
opacity: 0;
|
|
242
|
+
height: 0;
|
|
243
|
+
overflow: clip;
|
|
244
|
+
}
|
|
238
245
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
.mobile-details:open svg.iconify-arrow {
|
|
247
|
+
transform: rotate(180deg);
|
|
248
|
+
}
|
|
242
249
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
.mobile-details:open::details-content {
|
|
251
|
+
height: auto;
|
|
252
|
+
opacity: 1;
|
|
253
|
+
}
|
|
247
254
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
.mobile-submenu,
|
|
256
|
+
.mobile-subsubmenu {
|
|
257
|
+
border-left: dashed 1px var(--accent-color, #00ffff);
|
|
258
|
+
padding-left: 2rem;
|
|
259
|
+
margin-left: 1rem;
|
|
260
|
+
margin-top: 1rem;
|
|
261
|
+
list-style: none;
|
|
262
|
+
gap: 1rem;
|
|
263
|
+
display: flex;
|
|
264
|
+
flex-direction: column;
|
|
265
|
+
}
|
|
259
266
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
267
|
+
.mobile-header__menu.is-active {
|
|
268
|
+
transform: translateX(-7%);
|
|
269
|
+
}
|
|
263
270
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
/* Adjust transform for fullscreen header */
|
|
272
|
+
.mobile-header__menu--fullscreen.is-active {
|
|
273
|
+
transform: translate(0%);
|
|
274
|
+
}
|
|
268
275
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
+
.menu__summary {
|
|
277
|
+
width: 100%;
|
|
278
|
+
font-size: 1.7rem;
|
|
279
|
+
height: 5rem;
|
|
280
|
+
color: inherit;
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: center;
|
|
283
|
+
}
|
|
276
284
|
}
|
|
277
285
|
</style>
|
package/src/MoonIcon.astro
CHANGED
|
@@ -46,61 +46,69 @@ const content = replaceIDs(
|
|
|
46
46
|
/>
|
|
47
47
|
|
|
48
48
|
<style is:inline>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
stroke: white;
|
|
55
|
-
stroke-linecap: round;
|
|
56
|
-
stroke-linejoin: round;
|
|
57
|
-
stroke-width: var(--svg-stroke-width--2px, 2px);
|
|
58
|
-
d: path(
|
|
59
|
-
"M12 21v1M21 12h1M12 3v-1M3 12h-1M18.5 18.5l0.5 0.5M18.5 5.5l0.5 -0.5M5.5 5.5l-0.5 -0.5M5.5 18.5l-0.5 0.5"
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
.t_ev7s {
|
|
63
|
-
d: path("M0 0h24v24H0z");
|
|
64
|
-
}
|
|
65
|
-
.izfmla {
|
|
66
|
-
stroke: white;
|
|
67
|
-
stroke-linecap: round;
|
|
68
|
-
stroke-linejoin: round;
|
|
69
|
-
stroke-width: var(--svg-stroke-width--2px, 2px);
|
|
70
|
-
d: path(
|
|
71
|
-
"M7 6c0 6.08 4.92 11 11 11c0.53 0 1.05 -0.04 1.56 -0.11c-1.61 2.47 -4.39 4.11 -7.56 4.11c-4.97 0 -9 -4.03 -9 -9c0 -3.17 1.64 -5.95 4.11 -7.56c-0.07 0.51 -0.11 1.03 -0.11 1.56Z"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
.abf34n {
|
|
75
|
-
fill: none;
|
|
76
|
-
stroke: white;
|
|
77
|
-
stroke-dasharray: 4;
|
|
78
|
-
stroke-linecap: round;
|
|
79
|
-
stroke-linejoin: round;
|
|
80
|
-
}
|
|
81
|
-
.k7_l3l {
|
|
82
|
-
d: path("M12 5h1.5M12 5h-1.5M12 5v1.5M12 5v-1.5");
|
|
83
|
-
}
|
|
84
|
-
.hhuniw {
|
|
85
|
-
d: path("M17 11h1.5M17 11h-1.5M17 11v1.5M17 11v-1.5");
|
|
86
|
-
}
|
|
49
|
+
/*
|
|
50
|
+
* base (resets) < components (ours) < utilities (consumer classNames).
|
|
51
|
+
* Order statement keeps it deterministic regardless of bundling order.
|
|
52
|
+
*/
|
|
53
|
+
@layer theme, base, components, utilities;
|
|
87
54
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
55
|
+
@layer components {
|
|
56
|
+
.n1mjuz {
|
|
57
|
+
fill: var(--svg-color--fff, #fff);
|
|
58
|
+
}
|
|
59
|
+
.smogax {
|
|
60
|
+
fill: none;
|
|
61
|
+
stroke: white;
|
|
62
|
+
stroke-linecap: round;
|
|
63
|
+
stroke-linejoin: round;
|
|
64
|
+
stroke-width: var(--svg-stroke-width--2px, 2px);
|
|
65
|
+
d: path(
|
|
66
|
+
"M12 21v1M21 12h1M12 3v-1M3 12h-1M18.5 18.5l0.5 0.5M18.5 5.5l0.5 -0.5M5.5 5.5l-0.5 -0.5M5.5 18.5l-0.5 0.5"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
.t_ev7s {
|
|
70
|
+
d: path("M0 0h24v24H0z");
|
|
71
|
+
}
|
|
72
|
+
.izfmla {
|
|
73
|
+
stroke: white;
|
|
74
|
+
stroke-linecap: round;
|
|
75
|
+
stroke-linejoin: round;
|
|
76
|
+
stroke-width: var(--svg-stroke-width--2px, 2px);
|
|
77
|
+
d: path(
|
|
78
|
+
"M7 6c0 6.08 4.92 11 11 11c0.53 0 1.05 -0.04 1.56 -0.11c-1.61 2.47 -4.39 4.11 -7.56 4.11c-4.97 0 -9 -4.03 -9 -9c0 -3.17 1.64 -5.95 4.11 -7.56c-0.07 0.51 -0.11 1.03 -0.11 1.56Z"
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
.abf34n {
|
|
82
|
+
fill: none;
|
|
83
|
+
stroke: white;
|
|
84
|
+
stroke-dasharray: 4;
|
|
85
|
+
stroke-linecap: round;
|
|
86
|
+
stroke-linejoin: round;
|
|
87
|
+
}
|
|
88
|
+
.k7_l3l {
|
|
89
|
+
d: path("M12 5h1.5M12 5h-1.5M12 5v1.5M12 5v-1.5");
|
|
90
|
+
}
|
|
91
|
+
.hhuniw {
|
|
92
|
+
d: path("M17 11h1.5M17 11h-1.5M17 11v1.5M17 11v-1.5");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.z8cgtd {
|
|
96
|
+
d: path("M20 5h1.5M20 5h-1.5M20 5v1.5M20 5v-1.5");
|
|
97
|
+
}
|
|
98
|
+
.drcfta {
|
|
99
|
+
d: path("M12 4h1.5M12 4h-1.5M12 4v1.5M12 4v-1.5");
|
|
100
|
+
}
|
|
101
|
+
.yij7vx {
|
|
102
|
+
d: path("M18 12h1.5M18 12h-1.5M18 12v1.5M18 12v-1.5");
|
|
103
|
+
}
|
|
104
|
+
.emoajy {
|
|
105
|
+
d: path("M19 4h1.5M19 4h-1.5M19 4v1.5M19 4v-1.5");
|
|
106
|
+
}
|
|
107
|
+
.f1to6s {
|
|
108
|
+
d: path("M13 4h1.5M13 4h-1.5M13 4v1.5M13 4v-1.5");
|
|
109
|
+
}
|
|
110
|
+
.niixso {
|
|
111
|
+
d: path("M19 11h1.5M19 11h-1.5M19 11v1.5M19 11v-1.5");
|
|
112
|
+
}
|
|
105
113
|
}
|
|
106
114
|
</style>
|