From 44b55d9bbbc22329e19a28d040e93a6194a88ef3 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sun, 3 Nov 2024 11:21:44 +0100 Subject: [PATCH] navigation on collections and dynamic routing improvements --- components/CollectionDetail.vue | 18 +++++++++ components/ContentBuilder.vue | 24 ++++++----- components/Header.vue | 4 +- components/shared/Hero.vue | 8 ++-- pages/[...slug].vue | 64 +++++++++++++++++++++--------- pages/index.vue | 2 +- types/collection/article.ts | 14 ++----- types/collection/baseCollection.ts | 12 ++++++ types/collection/event.ts | 5 +++ types/collection/lookup.ts | 9 +++++ types/collection/operation.ts | 5 +++ 11 files changed, 117 insertions(+), 48 deletions(-) create mode 100644 components/CollectionDetail.vue create mode 100644 types/collection/baseCollection.ts create mode 100644 types/collection/event.ts create mode 100644 types/collection/lookup.ts create mode 100644 types/collection/operation.ts diff --git a/components/CollectionDetail.vue b/components/CollectionDetail.vue new file mode 100644 index 0000000..a609ccf --- /dev/null +++ b/components/CollectionDetail.vue @@ -0,0 +1,18 @@ + + + diff --git a/components/ContentBuilder.vue b/components/ContentBuilder.vue index ca3b99e..3ad73aa 100644 --- a/components/ContentBuilder.vue +++ b/components/ContentBuilder.vue @@ -1,14 +1,16 @@ @@ -19,7 +21,7 @@ import type SharedHero from "../types/component/sharedHero"; import type { ComponentTypes } from "../types/component/baseComponent"; defineProps({ - hero: Object as PropType, + hero: { type: Object as PropType, required: false, default: null }, content: Array, }); diff --git a/components/Header.vue b/components/Header.vue index 674ad96..1b89705 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -9,7 +9,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 ?? ''}`" :class="link.URL == params?.[0] ? 'active' : ''" > {{ link.name }} @@ -26,7 +26,7 @@ v-for="sublink in navbar_sub_items" :key="sublink.id" :to="`/${params?.[0]}/${sublink.URL}`" - :class="sublink.URL == params?.[1] ? 'active' : ''" + :class="sublink.URL == params?.[1] && !params[2] ? 'active' : ''" > {{ sublink.name }} diff --git a/components/shared/Hero.vue b/components/shared/Hero.vue index 6c201c0..1920ede 100644 --- a/components/shared/Hero.vue +++ b/components/shared/Hero.vue @@ -1,13 +1,13 @@