@mirweb/mir-web-components 2.10.1 → 2.11.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.
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="header__wrapper"
|
|
4
|
+
:class="{
|
|
5
|
+
'header--hide-burger': !hasBurgerContent,
|
|
6
|
+
'header--align-secondary-right': !hasBurgerContent,
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
3
9
|
<nav aria-label="Main navigation">
|
|
4
10
|
<!-- Main nav -->
|
|
5
11
|
<div class="nav-wrapper">
|
|
@@ -207,6 +213,7 @@
|
|
|
207
213
|
</div>
|
|
208
214
|
</div>
|
|
209
215
|
<button
|
|
216
|
+
v-if="hasBurgerContent"
|
|
210
217
|
class="mobile-burger-wrapper"
|
|
211
218
|
aria-label="Toggle mobile menu"
|
|
212
219
|
@click.prevent="toggleBurger"
|
|
@@ -223,7 +230,10 @@
|
|
|
223
230
|
/>
|
|
224
231
|
</button>
|
|
225
232
|
</div>
|
|
226
|
-
<div
|
|
233
|
+
<div
|
|
234
|
+
v-show="hasBurgerContent && burgerState"
|
|
235
|
+
class="mobile-menu-content-wrapper"
|
|
236
|
+
>
|
|
227
237
|
<ul>
|
|
228
238
|
<slot name="mobile-main-nav-items"></slot>
|
|
229
239
|
</ul>
|
|
@@ -238,10 +248,11 @@
|
|
|
238
248
|
</template>
|
|
239
249
|
|
|
240
250
|
<script setup lang="ts">
|
|
241
|
-
import { ref, onMounted, onUnmounted, watch } from "vue";
|
|
251
|
+
import { ref, computed, onMounted, onUnmounted, watch, useSlots } from "vue";
|
|
242
252
|
import AtomLink from "../../atoms/link/link.vue";
|
|
243
253
|
|
|
244
254
|
let clickEventListener: ((e: MouseEvent) => void) | null = null;
|
|
255
|
+
const slots = useSlots();
|
|
245
256
|
const props = defineProps({
|
|
246
257
|
burgerState: {
|
|
247
258
|
type: Boolean,
|
|
@@ -290,6 +301,29 @@ const props = defineProps({
|
|
|
290
301
|
},
|
|
291
302
|
});
|
|
292
303
|
let burgerState = ref(props.burgerState);
|
|
304
|
+
|
|
305
|
+
// Hide burger automatically when there's nothing to show in it (no nav links, no dropdown)
|
|
306
|
+
const hasBurgerContent = computed(() => {
|
|
307
|
+
const mainNav = slots["main-nav-items"]?.();
|
|
308
|
+
const mobileMainNav = slots["mobile-main-nav-items"]?.();
|
|
309
|
+
const hasNavItems =
|
|
310
|
+
(mainNav?.length ?? 0) > 0 || (mobileMainNav?.length ?? 0) > 0;
|
|
311
|
+
|
|
312
|
+
if (props.useDropdown) {
|
|
313
|
+
const dropTitle = slots["dropdown-title"]?.();
|
|
314
|
+
const dropLinks = slots["dropdown-links"]?.();
|
|
315
|
+
const mobileDropTitle = slots["mobile-dropdown-title"]?.();
|
|
316
|
+
const mobileDropLinks = slots["mobile-dropdown-links"]?.();
|
|
317
|
+
const hasDropdownItems =
|
|
318
|
+
(dropTitle?.length ?? 0) > 0 ||
|
|
319
|
+
(dropLinks?.length ?? 0) > 0 ||
|
|
320
|
+
(mobileDropTitle?.length ?? 0) > 0 ||
|
|
321
|
+
(mobileDropLinks?.length ?? 0) > 0;
|
|
322
|
+
return hasNavItems || hasDropdownItems;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return hasNavItems;
|
|
326
|
+
});
|
|
293
327
|
let search = ref(props.search);
|
|
294
328
|
let showDropDown = ref(props.showDropDown);
|
|
295
329
|
let showPortalSwitcherDropDown = ref(props.showPortalSwitcherDropDown);
|
|
@@ -406,6 +440,10 @@ defineExpose({
|
|
|
406
440
|
gap: 15px;
|
|
407
441
|
}
|
|
408
442
|
|
|
443
|
+
.header--align-secondary-right .secondary-nav-items {
|
|
444
|
+
margin-left: auto;
|
|
445
|
+
}
|
|
446
|
+
|
|
409
447
|
.main-nav-items a {
|
|
410
448
|
font-size: $font-size-xsm;
|
|
411
449
|
font-weight: 300;
|
|
@@ -564,8 +602,14 @@ defineExpose({
|
|
|
564
602
|
box-shadow: $box-shadow;
|
|
565
603
|
border-radius: $border-radius;
|
|
566
604
|
padding: 0px;
|
|
567
|
-
|
|
568
|
-
|
|
605
|
+
/* Mobile/tablet (< 984px): align with viewport padding */
|
|
606
|
+
right: 30px;
|
|
607
|
+
top: 60px;
|
|
608
|
+
|
|
609
|
+
@include md {
|
|
610
|
+
right: 0px;
|
|
611
|
+
top: 45px;
|
|
612
|
+
}
|
|
569
613
|
}
|
|
570
614
|
|
|
571
615
|
.portal-switcher-content {
|
|
@@ -750,6 +794,20 @@ defineExpose({
|
|
|
750
794
|
.mobile-nav-wrapper.mirsaic-mobile-bg::before {
|
|
751
795
|
opacity: 1;
|
|
752
796
|
}
|
|
797
|
+
|
|
798
|
+
/* When burger has no content: logo left, portal right (no burger, no expandable menu) */
|
|
799
|
+
.header--hide-burger .mobile-logo-search-burger-wrapper {
|
|
800
|
+
grid-template-columns: 1fr 44px;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.header--hide-burger .mobile-menu-content-wrapper {
|
|
804
|
+
display: none;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/* Portal dropdown: align right when no burger - mobile uses right: 30px from media query above */
|
|
808
|
+
.header--hide-burger #menu-portal-switcher-mobile .portal-switcher-content {
|
|
809
|
+
left: auto;
|
|
810
|
+
}
|
|
753
811
|
.mobile-nav-wrapper::before {
|
|
754
812
|
@extend .mirsaic--dark !optional;
|
|
755
813
|
background-size:
|