Compare commits

..

2 commits

Author SHA1 Message Date
69fd756a5a embedding 2025-01-18 11:39:03 +01:00
9d81666a3c file download component 2025-01-18 11:30:46 +01:00
16 changed files with 101 additions and 20 deletions

View file

@ -9,6 +9,8 @@
<DynamicZoneFullImage v-else-if="item.__component == 'dynamic-zone.full-image'" :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" /> <DynamicZoneFullText v-else-if="item.__component == 'dynamic-zone.full-text'" :data="item" />
<DynamicZoneGallery v-else-if="item.__component == 'dynamic-zone.gallery'" :data="item" /> <DynamicZoneGallery v-else-if="item.__component == 'dynamic-zone.gallery'" :data="item" />
<DynamicZoneFileDownload v-else-if="item.__component == 'dynamic-zone.file-download'" :data="item" />
<DynamicZoneEmbedding v-else-if="item.__component == 'dynamic-zone.embedding'" :data="item" />
<SharedList v-else-if="item.__component == 'shared.list'" :data="item" /> <SharedList v-else-if="item.__component == 'shared.list'" :data="item" />
<br /> <br />
</div> </div>

View file

@ -0,0 +1,15 @@
<template>
<div class="flex flex-col gap-2 w-full min-h-fit max-w-4xl mx-auto">
<h1 class="text-center">{{ data.title }}</h1>
<iframe :src="data.link" class="w-full h-[90vh]"></iframe>
</div>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneEmbedding from "../../types/component/dynamicZoneEmbedding";
const props = defineProps({
data: Object as PropType<DynamicZoneEmbedding>,
});
</script>

View file

@ -0,0 +1,42 @@
<template>
<div v-if="showComponent" class="flex flex-col gap-2 w-full min-h-fit max-w-4xl mx-auto">
<h1 class="text-center">{{ data.title }}</h1>
<iframe v-if="data.file.mime == 'application/pdf'" :src="baseUrl + data.file.url" class="w-full h-[90vh]"></iframe>
<NuxtPicture
v-if="data.file.mime.includes('image')"
loading="lazy"
class="w-full object-cover object-center mx-auto"
:src="baseUrl + data?.file.url"
:imgAttrs="{ class: 'w-full h-full object-cover object-center' }"
/>
<a
v-if="data.enable_download"
:href="baseUrl + data.file.url"
:download="data.file.name"
target="_blank"
class="w-fit text-primary underline"
>
Datei herunterladen
</a>
</div>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type DynamicZoneFileDownload from "../../types/component/dynamicZoneFileDownload";
const runtimeConfig = useRuntimeConfig();
const baseUrl = runtimeConfig.public.strapi.url;
const props = defineProps({
data: Object as PropType<DynamicZoneFileDownload>,
});
const showComponent = computed(() => {
if (props.data.file.mime == "application/pdf" || props.data.file.mime.includes("image")) {
return true;
} else {
return props.data.enable_download;
}
});
</script>

View file

@ -1,4 +1,4 @@
import type BaseImage from "../component/baseImage"; import type BaseFile from "../component/baseFile";
import type BaseCollection from "./baseCollection"; import type BaseCollection from "./baseCollection";
export default interface Article extends BaseCollection {} export default interface Article extends BaseCollection {}

View file

@ -1,4 +1,4 @@
import type BaseImage from "../component/baseImage"; import type BaseFile from "../component/baseFile";
import type ContentField from "../field/content"; import type ContentField from "../field/content";
export default interface BaseCollection { export default interface BaseCollection {
@ -14,6 +14,6 @@ export default interface BaseCollection {
description: string; description: string;
date: string | undefined; date: string | undefined;
content: ContentField | undefined; content: ContentField | undefined;
image: BaseImage | undefined; image: BaseFile | undefined;
attachment: Array<BaseImage>; attachment: Array<BaseFile>;
} }

View file

@ -1,4 +1,4 @@
import type BaseImage from "../component/baseImage"; import type BaseFile from "../component/baseFile";
import type BaseCollection from "./baseCollection"; import type BaseCollection from "./baseCollection";
export default interface Vehicle extends BaseCollection { export default interface Vehicle extends BaseCollection {

View file

@ -4,7 +4,9 @@ import type DynamicZoneEmphasiseArticle from "./dynamicZoneEmphasiseArticle";
import type DynamicZoneFullImage from "./dynamicZoneFullImage"; import type DynamicZoneFullImage from "./dynamicZoneFullImage";
import type DynamicZoneFullText from "./dynamicZoneFullText"; import type DynamicZoneFullText from "./dynamicZoneFullText";
import type DynamicZoneGallery from "./dynamicZoneGallery"; import type DynamicZoneGallery from "./dynamicZoneGallery";
import type DynamicZoneFileDownload from "./dynamicZoneFileDownload";
import type SharedList from "./sharedList"; import type SharedList from "./sharedList";
import type DynamicZoneEmbedding from "./dynamicZoneEmbedding";
export default interface BaseComponent { export default interface BaseComponent {
__component: ComponentNames; __component: ComponentNames;
@ -18,7 +20,9 @@ export type ComponentNames =
| "dynamic-zone.full-image" | "dynamic-zone.full-image"
| "dynamic-zone.emphasise-article" | "dynamic-zone.emphasise-article"
| "dynamic-zone.dual-column-text" | "dynamic-zone.dual-column-text"
| "dynamic-zone.column-image-text"; | "dynamic-zone.column-image-text"
| "dynamic-zone.file-download"
| "dynamic-zone.embedding";
export type ComponentTypes = export type ComponentTypes =
| SharedList | SharedList
@ -27,4 +31,6 @@ export type ComponentTypes =
| DynamicZoneFullImage | DynamicZoneFullImage
| DynamicZoneEmphasiseArticle | DynamicZoneEmphasiseArticle
| DynamicZoneDualColumnText | DynamicZoneDualColumnText
| DynamicZoneColumnImageText; | DynamicZoneColumnImageText
| DynamicZoneFileDownload
| DynamicZoneEmbedding;

View file

@ -1,4 +1,4 @@
export default interface BaseImage { export default interface BaseFile {
id: number; id: number;
documentId: string; documentId: string;
name: string; name: string;

View file

@ -1,10 +1,10 @@
import type ContentField from "../field/content"; import type ContentField from "../field/content";
import type BaseComponent from "./baseComponent"; import type BaseComponent from "./baseComponent";
import type BaseImage from "./baseImage"; import type BaseFile from "./baseFile";
export default interface DynamicZoneColumnImageText extends BaseComponent { export default interface DynamicZoneColumnImageText extends BaseComponent {
__component: "dynamic-zone.column-image-text"; __component: "dynamic-zone.column-image-text";
text: ContentField; text: ContentField;
image_left: boolean; image_left: boolean;
image: BaseImage; image: BaseFile;
} }

View file

@ -0,0 +1,7 @@
import type BaseComponent from "./baseComponent";
export default interface DynamicZoneEmbedding extends BaseComponent {
__component: "dynamic-zone.embedding";
title: string;
link: string;
}

View file

@ -0,0 +1,9 @@
import type BaseComponent from "./baseComponent";
import type BaseFile from "./baseFile";
export default interface DynamicZoneFileDownload extends BaseComponent {
__component: "dynamic-zone.file-download";
enable_download: boolean;
title: string;
file: BaseFile;
}

View file

@ -1,7 +1,7 @@
import type BaseComponent from "./baseComponent"; import type BaseComponent from "./baseComponent";
import type BaseImage from "./baseImage"; import type BaseFile from "./baseFile";
export default interface DynamicZoneFullImage extends BaseComponent { export default interface DynamicZoneFullImage extends BaseComponent {
__component: "dynamic-zone.full-image"; __component: "dynamic-zone.full-image";
image: BaseImage; image: BaseFile;
} }

View file

@ -1,7 +1,7 @@
import type BaseComponent from "./baseComponent"; import type BaseComponent from "./baseComponent";
import type BaseImage from "./baseImage"; import type BaseFile from "./baseFile";
export default interface DynamicZoneGallery extends BaseComponent { export default interface DynamicZoneGallery extends BaseComponent {
__component: "dynamic-zone.gallery"; __component: "dynamic-zone.gallery";
images: Array<BaseImage>; images: Array<BaseFile>;
} }

View file

@ -1,8 +1,8 @@
import type BaseImage from "./baseImage"; import type BaseFile from "./baseFile";
import type NavbarItem from "./itemsNavbarItem"; import type NavbarItem from "./itemsNavbarItem";
export default interface Navbar { export default interface Navbar {
id: number; id: number;
logo: BaseImage; logo: BaseFile;
navbar_items: NavbarItem[]; navbar_items: NavbarItem[];
} }

View file

@ -1,7 +1,7 @@
import type BaseImage from "./baseImage"; import type BaseFile from "./baseFile";
export default interface SharedHero { export default interface SharedHero {
id: number; id: number;
title: string; title: string;
banner: BaseImage; banner: BaseFile;
} }

View file

@ -1,4 +1,4 @@
import type BaseImage from "../component/baseImage"; import type BaseFile from "../component/baseFile";
import type { ComponentTypes } from "../component/baseComponent"; import type { ComponentTypes } from "../component/baseComponent";
export default interface Homepage { export default interface Homepage {
@ -8,7 +8,7 @@ export default interface Homepage {
updatedAt: string; updatedAt: string;
publishedAt: string; publishedAt: string;
locale: string; locale: string;
backdrop: BaseImage; backdrop: BaseFile;
hide_backdrop: boolean; hide_backdrop: boolean;
content: Array<ComponentTypes>; content: Array<ComponentTypes>;
} }