responsive and config

This commit is contained in:
Julian Krauser 2024-11-06 08:59:07 +01:00
parent e74c6a5a23
commit 5f4aedff31
10 changed files with 54 additions and 41 deletions

View file

@ -1,3 +1,12 @@
<template> <template>
<NuxtPage /> <NuxtPage />
</template> </template>
<script setup>
const runtimeConfig = useRuntimeConfig();
const appTitle = runtimeConfig.public.app.title;
useHead({
title: appTitle,
});
</script>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="min-h-[calc(100vh-9rem)] h-fit container mx-auto py-12"> <div class="min-h-[calc(100vh-9rem)] h-fit container mx-auto py-12 px-2">
<h1>{{ data?.title }}</h1> <h1>{{ data?.title }}</h1>
<p v-if="data?.date"> <p v-if="data?.date">
{{ {{
@ -18,9 +18,9 @@
<NuxtPicture <NuxtPicture
v-if="data?.image" v-if="data?.image"
loading="lazy" loading="lazy"
class="w-fit h-[50vh] max-w-full object-cover object-center" class="w-full h-full sm:w-fit sm:h-[50vh] max-w-full object-cover object-center"
:src="baseUrl + data.image.url" :src="baseUrl + data.image.url"
:imgAttrs="{ class: 'w-fit h-[50vh] max-w-full object-cover object-center' }" :imgAttrs="{ class: 'w-full h-full sm:w-fit sm:h-[50vh] object-cover object-center' }"
/> />
<br v-if="data?.image" /> <br v-if="data?.image" />
<div v-if="data?.content"> <div v-if="data?.content">
@ -30,13 +30,13 @@
<br /> <br />
<div v-if="data?.attachment"> <div v-if="data?.attachment">
<p>Anhang:</p> <p>Anhang:</p>
<div class="flex flex-row flex-wrap gap-2 w-full min-h-fit"> <div class="flex flex-col sm:flex-row flex-wrap gap-2 w-full min-h-fit">
<NuxtPicture <NuxtPicture
v-for="img in data.attachment" v-for="img in data.attachment"
loading="lazy" loading="lazy"
class="w-fit h-48 object-cover object-center" class="w-full h-fit sm:w-fit sm:h-48 object-cover object-center"
:src="baseUrl + img.url" :src="baseUrl + img.url"
:imgAttrs="{ class: 'w-fit h-48 object-cover object-center' }" :imgAttrs="{ class: 'w-full h-fit sm:w-fit sm:h-48 object-cover object-center' }"
/> />
</div> </div>
</div> </div>

View file

@ -1,12 +1,12 @@
<template> <template>
<div darkgray class="h-48 min-h-fit w-full px-5 py-10 flex-col justify-center items-center flex"> <div darkgray class="h-48 min-h-fit w-full px-5 py-10 flex-col justify-center items-center flex gap-2">
<div class="self-stretch py-5 justify-center items-center gap-4 md:gap-10 inline-flex flex-wrap"> <div class="self-stretch py-5 justify-center items-center gap-4 md:gap-10 inline-flex flex-wrap">
<NuxtLink v-for="link in footer.links" :key="link.id" :to="link.URL" :target="link.target" class="text-base"> <NuxtLink v-for="link in footer.links" :key="link.id" :to="link.URL" :target="link.target" class="text-base">
{{ link.text }} {{ link.text }}
</NuxtLink> </NuxtLink>
</div> </div>
<div class="text-base">@Copyright {{ new Date().getFullYear() }} {{ footer.copyright }}</div> <div class="text-base text-center">@Copyright {{ new Date().getFullYear() }} {{ footer.copyright }}</div>
<div class="text-base">verwaltet von {{ footer.designed_developed_by }}</div> <div class="text-base text-center">verwaltet von {{ footer.designed_developed_by }}</div>
</div> </div>
</template> </template>

View file

@ -10,24 +10,22 @@
:src="baseUrl + data?.image?.url" :src="baseUrl + data?.image?.url"
:imgAttrs="{ class: 'w-full h-56 object-cover object-center' }" :imgAttrs="{ class: 'w-full h-56 object-cover object-center' }"
/> />
<div class="w-full h-44 relative bg-white"> <div class="w-full h-44 relative bg-white px-2 py-5 flex flex-col justify-start items-start gap-2 overflow-y-auto">
<div class="w-full h-full px-2.5 py-5 flex flex-col justify-start items-start gap-2.5"> <h1>{{ data?.title }}</h1>
<h1>{{ data?.title }}</h1> <p v-if="data?.date" class="w-full text-[#5c5c5c]">
<p v-if="data?.date" class="self-stretch grow shrink basis-0 text-[#5c5c5c]"> {{
{{ new Date(data?.date ?? "").toLocaleString("de-DE", {
new Date(data?.date ?? "").toLocaleString("de-DE", { day: "2-digit",
day: "2-digit", month: "long",
month: "long", year: "numeric",
year: "numeric", minute: "2-digit",
minute: "2-digit", hour: "2-digit",
hour: "2-digit", })
}) }}
}} </p>
</p> <p class="w-full text-[#5c5c5c]">
<p class="self-stretch grow shrink basis-0 text-[#5c5c5c]"> {{ data?.description }}
{{ data?.description }} </p>
</p>
</div>
</div> </div>
</NuxtLink> </NuxtLink>
</template> </template>

View file

@ -2,7 +2,7 @@
<div class="flex flex-col md:flex-row gap-4"> <div class="flex flex-col md:flex-row gap-4">
<NuxtPicture <NuxtPicture
loading="lazy" loading="lazy"
class="w-1/2 min-w-[50%] h-fit object-cover object-center" class="w-full md:w-1/2 min-w-[50%] h-fit object-cover object-center"
:class="data?.image_left ? 'order-0' : 'order-1'" :class="data?.image_left ? 'order-0' : 'order-1'"
:src="baseUrl + data?.image.url" :src="baseUrl + data?.image.url"
:imgAttrs="{ class: 'w-full h-fit object-cover object-center' }" :imgAttrs="{ class: 'w-full h-fit object-cover object-center' }"

View file

@ -1,7 +1,7 @@
<template> <template>
<NuxtPicture <NuxtPicture
loading="lazy" loading="lazy"
class="w-full md:w-1/2 md:min-w-[50%] h-fit object-cover object-center mx-auto" class="w-full lg:w-1/2 lg:min-w-[50%] h-fit object-cover object-center mx-auto"
:src="baseUrl + data?.image.url" :src="baseUrl + data?.image.url"
:imgAttrs="{ class: 'w-full h-fit object-cover object-center' }" :imgAttrs="{ class: 'w-full h-fit object-cover object-center' }"
/> />

View file

@ -3,9 +3,9 @@
<NuxtPicture <NuxtPicture
v-for="img in data?.images" v-for="img in data?.images"
loading="lazy" loading="lazy"
class="w-full h-fit md:w-fit md:h-48 object-cover object-center" class="w-full h-fit sm:w-fit sm:h-48 object-cover object-center"
:src="baseUrl + img.url" :src="baseUrl + img.url"
:imgAttrs="{ class: 'w-full h-full object-cover object-center' }" :imgAttrs="{ class: 'w-full h-fit sm:w-fit sm:h-48 object-cover object-center' }"
/> />
</div> </div>
</template> </template>

View file

@ -21,6 +21,13 @@
<FieldType v-for="child in list.children" :data="child" /> <FieldType v-for="child in list.children" :data="child" />
</li> </li>
</ol> </ol>
<NuxtLink
v-else-if="item.type == 'code'"
primary
:to="item.children[0].text.split('->')[0]"
class="w-fit p-2 px-3 rounded-md mx-auto mt-3"
>{{ item.children[0].text.split("->")[1] }}</NuxtLink
>
</div> </div>
</div> </div>
</template> </template>

View file

@ -3,7 +3,7 @@ export default defineNuxtConfig({
app: { app: {
baseURL: "/", baseURL: "/",
head: { head: {
title: process.env.APP_TITLE, title: "Feuerwehr",
htmlAttrs: { htmlAttrs: {
lang: "de", lang: "de",
}, },
@ -31,24 +31,18 @@ export default defineNuxtConfig({
modules: ["@nuxtjs/strapi", "@nuxt/image"], modules: ["@nuxtjs/strapi", "@nuxt/image"],
strapi: { strapi: {
url: process.env.STRAPI_URL, url: process.env.PUBLIC_STRAPI_URL,
prefix: "/api", prefix: "/api",
version: "v5", version: "v5",
}, },
runtimeConfig: { runtimeConfig: {
strapi: {
url: process.env.STRAPI_URL ?? "localhost:1337",
},
app: {
title: process.env.APP_TITLE ?? "Feuerwehr",
},
public: { public: {
strapi: { strapi: {
url: process.env.STRAPI_URL ?? "localhost:1337", url: process.env.PUBLIC_STRAPI_URL ?? "localhost:1337",
}, },
app: { app: {
title: process.env.APP_TITLE ?? "Feuerwehr", title: process.env.PUBLIC_APP_TITLE ?? "Feuerwehr",
}, },
}, },
}, },

View file

@ -10,6 +10,11 @@ export default interface ContentField
format: "unordered" | "ordered"; format: "unordered" | "ordered";
children: Array<{ type: "list-item"; children: Array<TypeField> }>; children: Array<{ type: "list-item"; children: Array<TypeField> }>;
} }
| {
type: "code";
children: Array<{ type: "list-item"; children: Array<TypeField> }>;
language: "plaintext";
}
> {} > {}
export type TypeField = TextField | { type: "link"; url: string; children: Array<TextField> }; export type TypeField = TextField | { type: "link"; url: string; children: Array<TextField> };