From 5c56af0dad2a431702ef9530252378e29ff7d8f2 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sat, 2 Nov 2024 12:47:07 +0100 Subject: [PATCH] base zone components and type refinements --- components/ContentBuilder.vue | 24 ++++++++++++-- components/Footer.vue | 2 +- components/Header.vue | 6 ++-- components/dynamicZone/ColumnImageText.vue | 12 +++++++ components/dynamicZone/DualColumnText.vue | 12 +++++++ components/dynamicZone/EmphasiseArticle.vue | 12 +++++++ components/dynamicZone/FullImage.vue | 12 +++++++ components/dynamicZone/FullText.vue | 12 +++++++ components/dynamicZone/Gallery.vue | 12 +++++++ components/shared/Hero.vue | 25 +++++++++++++++ components/shared/List.vue | 12 +++++++ layouts/landing.vue | 10 ++++-- nuxt.config.ts | 3 +- package-lock.json | 32 ++++++++++--------- package.json | 2 +- pages/[...slug].vue | 23 ++++++++----- pages/index.vue | 4 +-- types/collection/article.ts | 13 ++++++++ types/collection/page.ts | 7 ++-- types/component/baseComponent.ts | 30 +++++++++++++++++ types/component/{image.ts => baseImage.ts} | 17 ++++++++-- types/component/dynamicZoneColumnImageText.ts | 9 ++++++ types/component/dynamicZoneDualColumnText.ts | 7 ++++ .../component/dynamicZoneEmphasiseArticle.ts | 9 ++++++ types/component/dynamicZoneFullImage.ts | 7 ++++ types/component/dynamicZoneFullText.ts | 6 ++++ types/component/dynamicZoneGallery.ts | 7 ++++ .../component/{footer.ts => globalFooter.ts} | 2 +- types/component/globalNavbar.ts | 8 +++++ .../{footerLink.ts => itemsFooterLink.ts} | 0 .../{navbarItem.ts => itemsNavbarItem.ts} | 2 +- ...navbarSubItem.ts => itemsNavbarSubItem.ts} | 0 types/component/navbar.ts | 8 ----- types/component/sharedHero.ts | 7 ++++ types/component/sharedLink.ts | 5 +++ types/component/sharedList.ts | 7 ++++ types/single/global.ts | 4 +-- types/single/homepage.ts | 7 ++-- 38 files changed, 323 insertions(+), 54 deletions(-) create mode 100644 components/dynamicZone/ColumnImageText.vue create mode 100644 components/dynamicZone/DualColumnText.vue create mode 100644 components/dynamicZone/EmphasiseArticle.vue create mode 100644 components/dynamicZone/FullImage.vue create mode 100644 components/dynamicZone/FullText.vue create mode 100644 components/dynamicZone/Gallery.vue create mode 100644 components/shared/Hero.vue create mode 100644 components/shared/List.vue create mode 100644 types/collection/article.ts create mode 100644 types/component/baseComponent.ts rename types/component/{image.ts => baseImage.ts} (55%) create mode 100644 types/component/dynamicZoneColumnImageText.ts create mode 100644 types/component/dynamicZoneDualColumnText.ts create mode 100644 types/component/dynamicZoneEmphasiseArticle.ts create mode 100644 types/component/dynamicZoneFullImage.ts create mode 100644 types/component/dynamicZoneFullText.ts create mode 100644 types/component/dynamicZoneGallery.ts rename types/component/{footer.ts => globalFooter.ts} (72%) create mode 100644 types/component/globalNavbar.ts rename types/component/{footerLink.ts => itemsFooterLink.ts} (100%) rename types/component/{navbarItem.ts => itemsNavbarItem.ts} (75%) rename types/component/{navbarSubItem.ts => itemsNavbarSubItem.ts} (100%) delete mode 100644 types/component/navbar.ts create mode 100644 types/component/sharedHero.ts create mode 100644 types/component/sharedLink.ts create mode 100644 types/component/sharedList.ts diff --git a/components/ContentBuilder.vue b/components/ContentBuilder.vue index 5f84a6b..ca3b99e 100644 --- a/components/ContentBuilder.vue +++ b/components/ContentBuilder.vue @@ -1,5 +1,25 @@ - + diff --git a/components/Footer.vue b/components/Footer.vue index 124e638..53af096 100644 --- a/components/Footer.vue +++ b/components/Footer.vue @@ -16,5 +16,5 @@ import type Global from "../types/single/global"; const { findOne } = useStrapi(); const { data: global } = await useAsyncData("global", () => findOne("global")); -const { footer } = global.value?.data as unknown as Global; +const { footer } = global.value?.data ?? ({} as Global); diff --git a/components/Header.vue b/components/Header.vue index a7056de..674ad96 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -17,9 +17,9 @@
findOne("global")); -const { navbar } = global.value?.data as unknown as Global; +const { navbar } = global.value?.data ?? ({} as Global); const navbar_sub_items = computed(() => { return navbar.navbar_items.find((ni) => ni.URL == params?.[0])?.navbar_sub_items; diff --git a/components/dynamicZone/ColumnImageText.vue b/components/dynamicZone/ColumnImageText.vue new file mode 100644 index 0000000..07da2b8 --- /dev/null +++ b/components/dynamicZone/ColumnImageText.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/dynamicZone/DualColumnText.vue b/components/dynamicZone/DualColumnText.vue new file mode 100644 index 0000000..3a35d8b --- /dev/null +++ b/components/dynamicZone/DualColumnText.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/dynamicZone/EmphasiseArticle.vue b/components/dynamicZone/EmphasiseArticle.vue new file mode 100644 index 0000000..6458670 --- /dev/null +++ b/components/dynamicZone/EmphasiseArticle.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/dynamicZone/FullImage.vue b/components/dynamicZone/FullImage.vue new file mode 100644 index 0000000..a1a1f35 --- /dev/null +++ b/components/dynamicZone/FullImage.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/dynamicZone/FullText.vue b/components/dynamicZone/FullText.vue new file mode 100644 index 0000000..10ab0af --- /dev/null +++ b/components/dynamicZone/FullText.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/dynamicZone/Gallery.vue b/components/dynamicZone/Gallery.vue new file mode 100644 index 0000000..402462c --- /dev/null +++ b/components/dynamicZone/Gallery.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/shared/Hero.vue b/components/shared/Hero.vue new file mode 100644 index 0000000..6c201c0 --- /dev/null +++ b/components/shared/Hero.vue @@ -0,0 +1,25 @@ + + + diff --git a/components/shared/List.vue b/components/shared/List.vue new file mode 100644 index 0000000..93d63fb --- /dev/null +++ b/components/shared/List.vue @@ -0,0 +1,12 @@ + + + diff --git a/layouts/landing.vue b/layouts/landing.vue index 030733c..4c11b68 100644 --- a/layouts/landing.vue +++ b/layouts/landing.vue @@ -1,6 +1,12 @@