base zone components and type refinements

This commit is contained in:
Julian Krauser 2024-11-02 12:47:07 +01:00
parent 9d96e3a6dc
commit 5c56af0dad
38 changed files with 323 additions and 54 deletions

View file

@ -1,5 +1,25 @@
<template>
<p>Content Builder</p>
<SharedHero v-if="hero" :data="hero" />
<div class="container mx-auto py-12 min-h-[50vh]">
<div v-for="item in content" class="contents">
<DynamicZoneColumnImageText v-if="item.__component == 'dynamic-zone.column-image-text'" :data="item" />
<DynamicZoneDualColumnText v-else-if="item.__component == 'dynamic-zone.dual-column-text'" :data="item" />
<DynamicZoneEmphasiseArticle v-else-if="item.__component == 'dynamic-zone.emphasise-article'" :data="item" />
<DynamicZoneFullImage v-else-if="item.__component == 'dynamic-zone.full-image'" :data="item" />
<DynamicZoneFullText v-else-if="item.__component == 'dynamic-zone.full-text'" :data="item" />
<DynamicZoneGallery v-else-if="item.__component == 'dynamic-zone.gallery'" :data="item" />
<SharedList v-else-if="item.__component == 'shared.list'" :data="item" />
</div>
</div>
</template>
<script setup lang="ts"></script>
<script setup lang="ts">
import type { PropType } from "vue";
import type SharedHero from "../types/component/sharedHero";
import type { ComponentTypes } from "../types/component/baseComponent";
defineProps({
hero: Object as PropType<SharedHero>,
content: Array<ComponentTypes>,
});
</script>

View file

@ -16,5 +16,5 @@ import type Global from "../types/single/global";
const { findOne } = useStrapi();
const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));
const { footer } = global.value?.data as unknown as Global;
const { footer } = global.value?.data ?? ({} as Global);
</script>

View file

@ -17,9 +17,9 @@
</div>
</div>
<div
v-if="navbar_sub_items?.length != 0"
v-if="navbar_sub_items && navbar_sub_items?.length != 0"
primary
class="h-12 min-h-fit w-full px-12 border-t-2 border-white justify-center items-center gap-5 flex"
class="h-fit min-h-fit w-full px-12 border-t-2 border-white justify-center items-center gap-5 flex"
>
<NuxtLink
primary-sublink
@ -44,7 +44,7 @@ const baseUrl = useStrapiUrl().replace("/api", "");
const { findOne } = useStrapi();
const { data: global } = await useAsyncData("global", () => findOne<Global>("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;

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneColumnImageText from "../../types/component/dynamicZoneColumnImageText";
defineProps({
data: Object as PropType<DynamicZoneColumnImageText>,
});
</script>

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneDualColumnText from "../../types/component/dynamicZoneDualColumnText";
defineProps({
data: Object as PropType<DynamicZoneDualColumnText>,
});
</script>

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneEmphasiseArticle from "../../types/component/dynamicZoneEmphasiseArticle";
defineProps({
data: Object as PropType<DynamicZoneEmphasiseArticle>,
});
</script>

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneFullImage from "../../types/component/dynamicZoneFullImage";
defineProps({
data: Object as PropType<DynamicZoneFullImage>,
});
</script>

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneFullText from "../../types/component/dynamicZoneFullText";
defineProps({
data: Object as PropType<DynamicZoneFullText>,
});
</script>

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneGallery from "../../types/component/dynamicZoneGallery";
defineProps({
data: Object as PropType<DynamicZoneGallery>,
});
</script>

View file

@ -0,0 +1,25 @@
<template>
<div class="w-full max-h-60 h-60">
<NuxtPicture
preload
loading="lazy"
class="w-full h-full object-cover object-center"
:src="baseUrl + data?.banner.url"
:imgAttrs="{ class: 'w-full h-full object-cover object-center' }"
/>
<div primary class="h-12 w-full px-12 justify-center items-center gap-5 flex">
<p>{{ data?.title }}</p>
</div>
</div>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type SharedHero from "../../types/component/sharedHero";
defineProps({
data: Object as PropType<SharedHero>,
});
const baseUrl = useStrapiUrl().replace("/api", "");
</script>

View file

@ -0,0 +1,12 @@
<template>
<p>{{ data }}</p>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type SharedList from "../../types/component/sharedList";
defineProps({
data: Object as PropType<SharedList>,
});
</script>