Starter Projekt angefangen, etwas aufzubohren und ein paar grundlegend benötigte Collections, Teheming-Styles und Komponenten hinzugefügt. (WIP)

This commit is contained in:
2022-05-24 16:44:55 +02:00
parent f4b6bb17ca
commit 47fdee2396
75 changed files with 2086 additions and 1234 deletions

View File

@@ -0,0 +1,73 @@
<script lang="ts">
import { navigate } from "svelte-routing"
import { apiBaseURL } from "../../config"
export let article: SWArticle
export let cssClass: string = ""
export let showDetails: boolean = false
const getImageSrc = () => {
return `${apiBaseURL}articles/${article?.id}/${article?.image?.src}?filter=l`
}
</script>
<article class="{article?.position} {cssClass}">
{#if article?.position !== "content"}
<div
class="article-image"
style="background-image: url({getImageSrc()});"
>
{#if article?.title}
<div class="article-title">{@html article?.title}</div>
{/if}
{#if article?.position === "top" || article?.position === "end-of-content"}
{#if article?.subtitle}
<div class="article-subtitle">
{@html article?.subtitle}
</div>
{/if}
{/if}
</div>
{/if}
{#if article?.position !== "top"}
<div class="article-content">
{#if article?.position === "content"}
{#if article?.title}
<div class="article-title">{@html article?.title}</div>
{/if}
{/if}
{#if article?.position === "content" || article?.position === "top-of-content"}
{#if article?.subtitle}
<div class="article-subtitle mb-md">
{@html article?.subtitle}
</div>
{/if}
{/if}
{#if !showDetails && article?.content}
<div class="mb-lg">
{@html article?.content}
</div>
{/if}
{#if showDetails && article?.details?.length}
<div class="mb-lg">
{@html article?.details}
</div>
{/if}
</div>
{/if}
{#if !showDetails && article?.details}
<div
class="article-link"
on:click="{() => {
navigate('/articles/' + article?.id)
}}"
>
Details
</div>
{/if}
</article>

View File

@@ -0,0 +1,160 @@
<script lang="ts">
import { fade } from "svelte/transition"
import { mdiCheck, mdiChevronDown } from "@mdi/js"
import Icon from "mdi-svelte"
import { sendEmail } from "../../api"
export let type: string
export let collapsed: boolean = false
let formData: {
name: string
email: string
subject: string
message: string
privacy: boolean
} = {
name: null,
email: null,
subject: null,
message: null,
privacy: false,
}
let requestSucessfully: boolean = false
let requestPending: boolean = false
const submit = () => {
if (
formData["name"] &&
formData["email"] &&
formData["subject"] &&
formData["message"] &&
formData["privacy"]
) {
requestPending = true
sendEmail(type + "Form", formData)
.then(() => {
resetForm()
requestSucessfully = true
requestPending = false
setTimeout(() => {
requestSucessfully = false
}, 10000)
})
.catch((e) => {
console.error(e)
requestPending = false
})
.finally(() => {
requestPending = false
})
}
}
const resetForm = () => {
formData = {
name: null,
email: null,
subject: null,
message: null,
privacy: false,
}
}
$: isValid =
formData["name"] && formData["email"] && formData["subject"] && formData["message"] && formData["privacy"]
</script>
<div id="{type}">
<form on:submit|preventDefault="{submit}" class="mt-lg">
<div class="layout justify-content-space-between layout-gap-md">
<div class="hidden-sm icon {type}">
<!-- <img src="img/icon/{type}.svg" alt="" /> -->
</div>
<div class="titles" on:click="{() => (collapsed = !collapsed)}">
<h3 class="title">
{type === "contact" ? "Kontakt" : ""}
{type === "recipe" ? "Rezeptanfrage" : ""}
</h3>
<h4 class="subTitle">
{type === "contact" ? "Schreiben Sie uns Ihr Anliegen" : ""}
{type === "recipe" ? "Teilen Sie uns Ihren Rezeptwunsch mit" : ""}
</h4>
</div>
<div class="collapse-icon" class:collapsed="{!collapsed}" on:click="{() => (collapsed = !collapsed)}">
<Icon path="{mdiChevronDown}" size="2" />
</div>
</div>
{#if !collapsed}
<div>
<div class="row">
<div class="col-md-6 mt-sm">
<input
type="text"
bind:value="{formData['name']}"
placeholder="Name"
readonly="{requestPending}"
/>
</div>
<div class="col-md-6 mt-sm">
<input
type="text"
bind:value="{formData['email']}"
placeholder="E-Mail Adresse"
readonly="{requestPending}"
/>
</div>
</div>
<div class="row nospace">
<div class="col-md-12 mt-sm">
<input
type="text"
bind:value="{formData['subject']}"
placeholder="Betreff"
readonly="{requestPending}"
/>
</div>
</div>
<div class="row nospace">
<div class="col-md-12 mt-sm">
<textarea bind:value="{formData['message']}" readonly="{requestPending}"></textarea>
</div>
</div>
<div class="row nospace">
<div class="col-md-12 mt-sm">
<div class="layout layout-gap-md align-items-center">
<div
class="checkbox"
on:click="{() => {
formData.privacy = !formData.privacy
}}"
>
{#if formData.privacy}
<div class="icon">
<Icon path="{mdiCheck}" size="2" />
</div>
{/if}
</div>
<div on:click="{() => (formData.privacy = !formData.privacy)}">
<a href="/datenschutz"><strong>Datenschutz</strong></a> akzeptieren
</div>
</div>
</div>
</div>
{#if requestSucessfully}
<div class="mt-sm" transition:fade>
<div>
<strong>Vielen Dank für Ihre Kontaktaufnahme!</strong>
</div>
<p>Wir werden uns zeitnah mit Ihnen in Verbindung setzen!</p>
</div>
{/if}
<div class="layout justify-content-end mt-sm">
<button type="submit" disabled="{!isValid || requestPending}">Absenden</button>
</div>
</div>
{/if}
</form>
</div>

View File

@@ -0,0 +1,11 @@
<script lang="ts">
import { generalInfo } from "../../store"
</script>
<div class="contact-information" id="contact-information">
<div class="container">
<div class="row">
<div class="col-md-12">...</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<script lang="ts">
import { generalInfo } from "../../store"
import Navigation from "./Navigation.svelte"
</script>
<footer>
<div class="container">
<div class="row">
<div class="col-md-12">
<Navigation ident="footer" />
</div>
</div>
{#if $generalInfo?.copyrightText}
<div class="row">
<div class="col-md-12">
<div class="copyright">
{$generalInfo?.copyrightText}
</div>
</div>
</div>
{/if}
</div>
</footer>

View File

@@ -0,0 +1,107 @@
<script lang="ts">
import { fade } from "svelte/transition"
import { getGalleries } from "../../api"
import { apiBaseURL } from "../../config"
import Modal from "./Modal.svelte"
export let article
let galleries: Gallery[]
const loadLinkedGalleries = async () => {
galleries = await getGalleries(article?.galleries)
}
loadLinkedGalleries()
let selectedImage = null
let selectedGallery = null
const showDetails = (gallery, image) => {
selectedImage = image
selectedGallery = gallery
console.log(selectedGallery.items.indexOf(image))
}
const closeDetails = () => {
selectedImage = null
selectedGallery = null
}
const next = () => {
let nextImage
let nextIndex = selectedGallery.items.indexOf(selectedImage) + 1
if (!selectedGallery.items[nextIndex]) {
nextImage = selectedGallery.items[0]
} else {
nextImage = selectedGallery.items[nextIndex]
}
selectedImage = nextImage
}
const prev = () => {
let prevImage
let prevIndex = selectedGallery.items.indexOf(selectedImage) - 1
if (prevIndex < 0) {
prevImage = selectedGallery.items[selectedGallery.items.length - 1]
} else {
prevImage = selectedGallery.items[prevIndex]
}
selectedImage = prevImage
}
const handleKeydown = (e) => {
if (e.keyCode === 37) {
prev()
}
if (e.keyCode === 39) {
next()
}
}
</script>
<svelte:window on:keydown="{handleKeydown}" />
<section class="galleries">
{#each galleries || [] as gallery}
<div class="gallery gallery-{gallery.variant}">
{#each gallery.items || [] as image, index}
<div class="gallery-item" on:click="{() => showDetails(gallery, image)}">
<img
src="{apiBaseURL}galleries/{gallery.id}/{image.file.src}?filter=s"
alt="{image.alt ? image.alt : image.title}"
/>
{#if gallery.variant === "simple-with-title"}
<div class="gallery-item-title">
{image.title}
</div>
{/if}
</div>
{/each}
</div>
{/each}
{#if selectedGallery && selectedImage}
<Modal show="{selectedGallery && selectedImage}">
<div transition:fade class="gallery-image-details">
<img
src="{apiBaseURL}galleries/{selectedGallery.id}/{selectedImage.file.src}?filter=l"
alt="{selectedImage.alt ? selectedImage.alt : selectedImage.title}"
on:click="{closeDetails}"
/>
<div class="gallery-info">
{#if selectedImage.title}
<div class="gallery-title">
{selectedImage.title}
</div>
{/if}
{#if selectedImage.description}
<div class="gallery-description">
{selectedImage.description}
</div>
{/if}
</div>
<div class="prev" on:click|preventDefault="{prev}">&#8249;</div>
<div class="next" on:click|preventDefault="{next}">&#8250;</div>
</div>
</Modal>
{/if}
</section>

View File

@@ -0,0 +1,22 @@
<script lang="ts">
import { generalInfo, ccTags } from "../../store"
$: iframeTitle =
$generalInfo?.person?.salutation +
" " +
$generalInfo?.person?.firstname +
" " +
$generalInfo?.person?.lastname +
" - " +
$generalInfo?.person?.additional
</script>
{#if $ccTags?.includes("googleMaps")}
<iframe
id="googleMaps"
title="{iframeTitle}"
src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d1342.4197187151062!2d10.4164909278422!3d50.56856037791808!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x2a509772539d6c1b!2sDr.%20med.%20Christine%20Wedekind!5e0!3m2!1sde!2sde!4v1652861335963!5m2!1sde!2sde"
allowfullscreen
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"></iframe>
{/if}

View File

@@ -0,0 +1,30 @@
<script lang="ts">
import { link } from "svelte-routing"
import { generalInfo } from "../../store"
import Navigation from "./Navigation.svelte"
import Image from "./Image.svelte"
</script>
<header>
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="header-content">
<a href="/" use:link>
<Image
file="{$generalInfo?.media?.brand}"
alt="{$generalInfo?.meta?.metaTitle}"
cssClass="brand"
/>
</a>
<div class="header-content-right">
<Navigation />
</div>
</div>
</div>
</div>
</div>
</header>

View File

@@ -0,0 +1,9 @@
<script lang="ts">
export let file: File = null
export let alt: string = ""
export let cssClass: string = ""
</script>
{#if file}
<img src="{file.src}" alt="{alt ? alt + ' - ' : ''}{file.path}" class="{cssClass}" />
{/if}

View File

@@ -0,0 +1,35 @@
<script lang="ts">
import { scale } from "svelte/transition"
export let show: boolean = false
export let size: string = "md"
const clickOnBackground = () => {
show = false
}
</script>
<div class="modal-wrapper" class:show on:click="{clickOnBackground}">
<div class="modal modal-{size}" transition:scale on:click|stopPropagation="{() => {}}">
{#if $$slots.close}
<div class="modal-close">
<slot name="close" />
</div>
{/if}
{#if $$slots.header}
<div class="modal-header">
<slot name="header" />
</div>
{/if}
{#if $$slots.default}
<div class="modal-content">
<slot />
</div>
{/if}
{#if $$slots.header}
<div class="modal-footer">
<slot name="footer" />
</div>
{/if}
</div>
</div>

View File

@@ -0,0 +1,78 @@
<script lang="ts">
import * as animateScroll from "svelte-scrollto"
import Icon from "mdi-svelte"
import { mdiMenu } from "@mdi/js"
// import { generalInfo } from "../../store"
import { links } from "svelte-routing"
import { navigations } from "../../store"
export let ident = "main"
let navigation: Navigation
let showMobileNav: boolean = false
$: {
$navigations?.map((nav) => {
if (nav.ident === ident) {
navigation = nav
}
})
}
</script>
{#if navigation}
<nav class="{ident}" use:links>
{#each navigation?.items || [] as item}
{#if item.settings.url.url}
<a
href="{item.settings.url.url}"
target="{item.settings.url.target}"
on:click="{() => {
animateScroll.scrollTo({ element: item.settings.url.url, offset: -200 })
showMobileNav = false
}}"
>
{item.settings.title}
</a>
{:else}
<a href="{item.settings.page}">
{item.settings.title}
</a>
{/if}
{/each}
</nav>
{#if ident === "main"}
<div class="nav-mobile-toggle" on:click="{() => (showMobileNav = !showMobileNav)}">
<Icon path="{mdiMenu}" size="2" />
</div>
<nav class="{ident}-mobile" class:show="{showMobileNav}" use:links>
<!-- <img src="img/body-image-left.svg" alt="" class="bg-image" /> -->
{#each navigation?.items || [] as item}
{#if item.settings.url.url}
<div class="nav-item">
<a
href="{item.settings.url.url}"
target="{item.settings.url.target}"
on:click="{() => {
animateScroll.scrollTo({ element: item.settings.url.url, offset: -200 })
showMobileNav = false
}}"
>
{item.settings.title}
</a>
</div>
{:else}
<div class="nav-item">
<a href="{item.settings.page}" on:click="{() => (showMobileNav = false)}">
{item.settings.title}
</a>
</div>
{/if}
{/each}
</nav>
{/if}
{/if}

View File

@@ -0,0 +1,56 @@
<script lang="ts">
import { news } from "../../store"
const getNewsDate = (news) => {
const from = news?.from ? new Date(news?.from) : null
const until = news?.until ? new Date(news?.until) : null
const options = { year: "numeric", month: "2-digit", day: "2-digit" }
let d = ""
if (from) {
// @ts-ignore
d += from.toLocaleDateString("de-DE", options)
}
if (until) {
// @ts-ignore
d += " bis " + until.toLocaleDateString("de-DE", options)
}
if (news.title) {
d += " - "
}
return d
}
</script>
{#if $news?.length}
<section class="news" id="news">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Neuigkeiten</h2>
</div>
</div>
<div class="row">
{#each $news as n}
{#if n.title || n.from || n.until}
<div class="col-md-6">
<article>
<div class="title">
{getNewsDate(n)}
{#if n.title}
{@html n.title}
{/if}
</div>
{#if n.content}
<div class="content">
{@html n.content}
</div>
{/if}
</article>
</div>
{/if}
{/each}
</div>
</div>
</section>
{/if}

View File

@@ -0,0 +1,74 @@
<svg
class="promotion-image-wave-top"
width="1920"
height="70"
viewBox="0 0 1920 70"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="m1920 70-80-12c-80-12-240-36-400-42s-320 6-480 18-320 24-480 18S160 22 80 10L0-2v-108h1920V70z"
fill="#fff"></path>
</svg>
<!-- <img src="img/promotion/promotion-image.png" alt="" class="promotion-image" /> -->
<svg class="promotion-image-wave-bottom" viewBox="0 0 1920 137" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M0 30.708 80 24.7c80-6.008 240-18.024 400-6.008 160 12.016 320 48.065 480 42.057 160-6.009 320-54.073 480-60.082 160-6.008 320 30.041 400 48.065l80 18.025V137H0V30.708z"
fill="url(#plkj8d2oga)"></path>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M0 30.708 80 24.7c80-6.008 240-18.024 400-6.008 160 12.016 320 48.065 480 42.057 160-6.009 320-54.073 480-60.082 160-6.008 320 30.041 400 48.065l80 18.025V137H0V30.708z"
fill="url(#iwnto70uxb)"></path>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M0 30.708 80 24.7c80-6.008 240-18.024 400-6.008 160 12.016 320 48.065 480 42.057 160-6.009 320-54.073 480-60.082 160-6.008 320 30.041 400 48.065l80 18.025V137H0V30.708z"
fill="url(#aco1fmuv9c)"></path>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M0 121.708 80 108.7c80-6.008 240-48.024 400-36.008 160 12.016 320 48.065 480 42.057 160-6.009 320-94.073 480-100.081 160-6.009 320 30.04 400 48.064l80 18.025V141H0v-19.292z"
fill="#fff"></path>
<defs>
<radialGradient
id="plkj8d2oga"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(960 0 0 41.5089 960 95.491)"
>
<stop stop-color="#FFFEFF"></stop>
<stop offset="1" stop-color="#D7FFFE"></stop>
</radialGradient>
<radialGradient
id="iwnto70uxb"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-652.99956 -34.96514 36.02623 -672.81617 1033.5 102.034)"
>
<stop stop-color="#BCFFFD"></stop>
<stop offset="1" stop-color="#fff" stop-opacity="0"></stop>
</radialGradient>
<radialGradient
id="aco1fmuv9c"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(8.473 63.69 3351.307) scale(825.005 723.955)"
>
<stop stop-color="#fff"></stop>
<stop offset="1" stop-color="#fff" stop-opacity="0"></stop>
</radialGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,37 @@
<script lang="ts">
import { createEventDispatcher } from "svelte"
const dispatch = createEventDispatcher()
</script>
<div class="scroll-to-top">
<div class="circle-email">
<a
href="/#"
on:click="{() => {
dispatch('scrollTo', {
element: 'contact',
})
}}"
>
<!-- <img src="img/icon/contact.svg" alt="" /> -->
</a>
</div>
<div class="circle-contact">
<a
href="/#"
on:click="{() => {
dispatch('scrollTo', {
element: 'recipe',
})
}}"
>
<!-- <img src="img/icon/recipe.svg" alt="" /> -->
</a>
</div>
<div class="circle-top">
<a href="/#">
<!-- <img src="img/icon/chevron-up.svg" alt="" /> -->
</a>
</div>
</div>