mirror of
https://github.com/complexcaresolutions/frontend.porwoll.de.git
synced 2026-03-17 18:43:42 +00:00
fix: correct field name mismatches in ImageTextBlock and QuoteBlock
ImageTextBlock: read CTA from cta group (cta.text/cta.link) instead of flat ctaLabel/ctaLink fields. QuoteBlock: read image from "image" field (not "backgroundImage"), support CMS style values (simple/highlighted/with-image) instead of the non-existent "parallax" value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d236d0e9f1
commit
6e7292aaf5
2 changed files with 60 additions and 33 deletions
|
|
@ -17,8 +17,9 @@ export function ImageTextBlock({ block }: ImageTextBlockProps) {
|
||||||
const imageUrl = (media?.url as string) || ''
|
const imageUrl = (media?.url as string) || ''
|
||||||
const imageAlt = (media?.alt as string) || title
|
const imageAlt = (media?.alt as string) || title
|
||||||
const imagePosition = (block.imagePosition as string) || 'left'
|
const imagePosition = (block.imagePosition as string) || 'left'
|
||||||
const ctaLabel = (block.ctaLabel as string) || (block.buttonText as string) || ''
|
const cta = block.cta as Record<string, unknown> | undefined
|
||||||
const ctaLink = (block.ctaLink as string) || (block.buttonLink as string) || ''
|
const ctaLabel = (cta?.text as string) || (block.ctaLabel as string) || ''
|
||||||
|
const ctaLink = (cta?.link as string) || (block.ctaLink as string) || ''
|
||||||
const backgroundColor = (block.backgroundColor as string) || 'light'
|
const backgroundColor = (block.backgroundColor as string) || 'light'
|
||||||
|
|
||||||
const isImageLeft = imagePosition === 'left'
|
const isImageLeft = imagePosition === 'left'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { motion } from 'framer-motion'
|
import { motion } from 'framer-motion'
|
||||||
|
import Image from 'next/image'
|
||||||
|
|
||||||
interface QuoteBlockProps {
|
interface QuoteBlockProps {
|
||||||
block: Record<string, unknown>
|
block: Record<string, unknown>
|
||||||
|
|
@ -10,14 +11,25 @@ export function QuoteBlock({ block }: QuoteBlockProps) {
|
||||||
const quote = (block.quote as string) || (block.text as string) || ''
|
const quote = (block.quote as string) || (block.text as string) || ''
|
||||||
const author = (block.author as string) || (block.attribution as string) || ''
|
const author = (block.author as string) || (block.attribution as string) || ''
|
||||||
const role = (block.role as string) || ''
|
const role = (block.role as string) || ''
|
||||||
const backgroundMedia = block.backgroundImage as Record<string, unknown> | undefined
|
const media = block.image as Record<string, unknown> | undefined
|
||||||
const backgroundUrl = backgroundMedia?.url as string | undefined
|
const imageUrl = (media?.url as string) || ''
|
||||||
const style = (block.style as string) || (backgroundUrl ? 'parallax' : 'simple')
|
const imageAlt = (media?.alt as string) || author
|
||||||
|
const style = (block.style as string) || 'simple'
|
||||||
|
|
||||||
if (style === 'simple') {
|
// Style "with-image": Autor mit Bild
|
||||||
|
if (style === 'with-image' && imageUrl) {
|
||||||
return (
|
return (
|
||||||
<section className="py-ws-m bg-light-bg">
|
<section className="py-ws-m bg-light-bg">
|
||||||
<div className="max-w-3xl mx-auto px-4 text-center">
|
<div className="max-w-3xl mx-auto px-4 text-center">
|
||||||
|
<div className="mb-6">
|
||||||
|
<Image
|
||||||
|
src={imageUrl}
|
||||||
|
alt={imageAlt}
|
||||||
|
width={80}
|
||||||
|
height={80}
|
||||||
|
className="rounded-full mx-auto object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<blockquote className="text-[1.4em] leading-[1.6em] text-gray italic mb-8">
|
<blockquote className="text-[1.4em] leading-[1.6em] text-gray italic mb-8">
|
||||||
“{quote}”
|
“{quote}”
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
@ -36,36 +48,50 @@ export function QuoteBlock({ block }: QuoteBlockProps) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Style "highlighted": Hervorgehobenes Zitat mit dunklem Hintergrund
|
||||||
|
if (style === 'highlighted') {
|
||||||
|
return (
|
||||||
|
<section className="relative bg-dark">
|
||||||
|
<motion.div
|
||||||
|
className="relative py-ws-m w-[90%] md:w-[55%] mx-auto text-center"
|
||||||
|
initial={{ opacity: 0, y: 30 }}
|
||||||
|
whileInView={{ opacity: 1, y: 0 }}
|
||||||
|
viewport={{ once: true }}
|
||||||
|
transition={{ duration: 0.6 }}
|
||||||
|
>
|
||||||
|
{/* Quote Icon */}
|
||||||
|
<span className="block text-[34px] text-white/50 mb-6">❝</span>
|
||||||
|
|
||||||
|
{/* Quote */}
|
||||||
|
<blockquote className="text-[1.2em] md:text-[1.4em] leading-[1.6em] text-white mb-8">
|
||||||
|
“{quote}”
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
{/* Author */}
|
||||||
|
<footer>
|
||||||
|
<cite className="font-heading text-[1em] tracking-[2px] uppercase text-white not-italic block mb-2">
|
||||||
|
{author}
|
||||||
|
</cite>
|
||||||
|
{role && (
|
||||||
|
<span className="font-heading text-[0.85em] tracking-[2px] uppercase text-gray-light">
|
||||||
|
{role}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</footer>
|
||||||
|
</motion.div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default: Style "simple"
|
||||||
return (
|
return (
|
||||||
<section
|
<section className="py-ws-m bg-light-bg">
|
||||||
className="relative bg-cover bg-center bg-fixed"
|
<div className="max-w-3xl mx-auto px-4 text-center">
|
||||||
style={{
|
<blockquote className="text-[1.4em] leading-[1.6em] text-gray italic mb-8">
|
||||||
backgroundImage: backgroundUrl ? `url(${backgroundUrl})` : undefined,
|
|
||||||
backgroundColor: !backgroundUrl ? '#111' : undefined,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* Overlay */}
|
|
||||||
<div className="absolute inset-0 bg-dark/50" />
|
|
||||||
|
|
||||||
{/* Content */}
|
|
||||||
<motion.div
|
|
||||||
className="relative py-ws-m w-[90%] md:w-[55%] mx-auto text-center"
|
|
||||||
initial={{ opacity: 0, y: 30 }}
|
|
||||||
whileInView={{ opacity: 1, y: 0 }}
|
|
||||||
viewport={{ once: true }}
|
|
||||||
transition={{ duration: 0.6 }}
|
|
||||||
>
|
|
||||||
{/* Quote Icon */}
|
|
||||||
<span className="block text-[34px] text-white/50 mb-6">❝</span>
|
|
||||||
|
|
||||||
{/* Quote */}
|
|
||||||
<blockquote className="text-[1.2em] md:text-[1.4em] leading-[1.6em] text-white mb-8">
|
|
||||||
“{quote}”
|
“{quote}”
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
{/* Author */}
|
|
||||||
<footer>
|
<footer>
|
||||||
<cite className="font-heading text-[1em] tracking-[2px] uppercase text-white not-italic block mb-2">
|
<cite className="font-heading text-[1em] tracking-[2px] uppercase text-dark not-italic block mb-2">
|
||||||
{author}
|
{author}
|
||||||
</cite>
|
</cite>
|
||||||
{role && (
|
{role && (
|
||||||
|
|
@ -74,7 +100,7 @@ export function QuoteBlock({ block }: QuoteBlockProps) {
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</footer>
|
</footer>
|
||||||
</motion.div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue