component formatting and types
This commit is contained in:
parent
c2a7d15eeb
commit
ce745c06e5
60 changed files with 464 additions and 301 deletions
|
@ -5,9 +5,11 @@
|
|||
class="h-24 min-h-fit w-full px-4 md:px-12 py-2.5 justify-between items-center gap-5 flex overflow-hidden"
|
||||
>
|
||||
<NuxtLink to="/">
|
||||
<img class="h-16" :src="baseUrl + navbar.logo.url" />
|
||||
<img v-if="logo" class="h-16" :src="baseUrl + logo.url" />
|
||||
<img v-else class="h-16" src="/favicon.png" />
|
||||
</NuxtLink>
|
||||
<div class="md:hidden">
|
||||
|
||||
<div v-if="navbar" class="md:hidden">
|
||||
<svg
|
||||
v-if="!open"
|
||||
viewBox="0 0 24 24"
|
||||
|
@ -27,6 +29,7 @@
|
|||
</div>
|
||||
|
||||
<div
|
||||
v-if="navbar"
|
||||
class="w-fit max-w-full p-2.5 justify-center items-center gap-7 flex flex-col md:flex-row md:flex-wrap"
|
||||
:class="open ? 'max-md:absolute top-24 left-0 max-md:w-full bg-primary' : 'max-md:hidden'"
|
||||
>
|
||||
|
@ -34,7 +37,7 @@
|
|||
primary-link
|
||||
v-for="link in navbar.navbar_items"
|
||||
:key="link.id"
|
||||
:to="`/${link.URL}/${link.default_active_child ?? ''}`"
|
||||
:to="`/${link.URL}${link.default_active_child ? '/' + link.default_active_child : ''}`"
|
||||
:class="link.URL == params?.[0] ? 'active' : ''"
|
||||
>
|
||||
{{ link.name }}
|
||||
|
@ -61,21 +64,21 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type Global from "../types/single/global";
|
||||
import provideGlobal from "../composables/provideGlobal";
|
||||
|
||||
const {
|
||||
params: { slug: params },
|
||||
} = useRoute();
|
||||
|
||||
const runtimeConfig = useRuntimeConfig();
|
||||
const baseUrl = runtimeConfig.public.strapi.url;
|
||||
const { findOne } = useStrapi();
|
||||
|
||||
const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));
|
||||
const { navbar } = global.value?.data ?? ({} as Global);
|
||||
const { logo, navbar } = await provideGlobal();
|
||||
|
||||
const open = ref(false);
|
||||
|
||||
const navbar_sub_items = computed(() => {
|
||||
if (!navbar) return [];
|
||||
return navbar.navbar_items.find((ni) => ni.URL == params?.[0])?.navbar_sub_items;
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue