Skip to content

Commit

Permalink
Fixed mobile navigation not working
Browse files Browse the repository at this point in the history
  • Loading branch information
tutaru99 committed Nov 8, 2024
1 parent 0e78740 commit 2ea5815
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
5 changes: 1 addition & 4 deletions components/globals/navigation/TheHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ onBeforeUnmount(() => {
<ClientOnly>
<Teleport to=".header-parent">
<Transition name="slide-left">
<TheOffCanvasMobileNavigation
v-if="showMobileNavigation"
:data="props.data"
/>
<TheOffCanvasMobileNavigation v-if="showMobileNavigation" />
</Transition>
</Teleport>
</ClientOnly>
Expand Down
29 changes: 18 additions & 11 deletions components/globals/navigation/TheOffCanvasMobileNavigation.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
<script setup lang="ts">
const props = defineProps({
data: {
type: Object,
required: true,
default: null,
},
import { useHeaderDataStore } from '~/stores/headerData';
const headerDataStore = useHeaderDataStore();
const navigationMenuData = computed(() => {
const mainKey = Object.keys(headerDataStore?.headerData || {}).find((key) =>
key.includes('main'),
);
return mainKey ? headerDataStore?.headerData?.[mainKey] : null;
});
const metaMenuData = computed(() => {
const metaKey = Object.keys(headerDataStore?.headerData || {}).find((key) =>
key.includes('meta'),
);
return metaKey ? headerDataStore?.headerData?.[metaKey] : null;
});
const showSubItems = ref(false);
Expand Down Expand Up @@ -48,9 +57,6 @@ const backButtonLabel = computed(() => {
return `${selectedParentItem?.value?.title}`;
});
const navigationMenuData = props.data.primaernavigation_2;
const metaMenuData = props.data.metamenu;
onMounted(() => {
document.body.style.overflow = 'hidden';
});
Expand Down Expand Up @@ -82,7 +88,7 @@ onUnmounted(() => {
"
:aria-label="'Link til ' + node?.title"
>
{{ node.title }}
{{ node?.title }}
<span v-if="node.below.length > 0">
<NuxtIcon filled name="chevron-right"
/></span>
Expand All @@ -101,7 +107,7 @@ onUnmounted(() => {
:to="metaItem.url"
:aria-label="'Link til ' + metaItem?.title"
>
{{ metaItem.title }}
{{ metaItem?.title }}
<span v-if="metaItem.below.length > 0">
<NuxtIcon filled name="chevron-right" />
</span>
Expand Down Expand Up @@ -181,6 +187,7 @@ onUnmounted(() => {
overflow-x: hidden;
background-color: var(--color-tertiary-lighten-6);
transition: background-color 0.3s ease-in-out;
padding-bottom: 62px;
&--white-bg {
background-color: var(--color-white);
Expand Down

0 comments on commit 2ea5815

Please sign in to comment.