frontend.blogwoman.de/src/components/blocks/CTABlock.tsx
CCS Admin 3a8693289f feat: migrate all types from local bridge pattern to @c2s/payload-contracts
Complete type migration removing all 33+ local interfaces and as-unknown-as
casts. All components now use contracts types directly with type-safe
relationship resolution via payload-helpers.ts.

Key changes:
- New payload-helpers.ts: resolveRelation, getMediaUrl, getMediaAlt, socialLinksToMap
- types.ts: thin re-export layer from contracts (backward-compatible aliases)
- api.ts: direct contracts types, no bridge casts, typed getSeoSettings
- All 17 block components: correct CMS field names (headline, subline, cta group, etc.)
- All route files: page.seo.metaTitle (not page.meta.title), getMediaUrl for unions
- structuredData.ts: proper types for all schema generators
- Footer: social links from separate collection via socialLinksToMap()
- Header/Footer: resolveMedia for logo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:25:16 +00:00

55 lines
1.5 KiB
TypeScript

import { Button } from '@/components/ui'
import { cn } from '@/lib/utils'
import type { BlockByType } from '@c2s/payload-contracts/types'
type CTABlockProps = Omit<BlockByType<'cta-block'>, 'blockType' | 'blockName'>
export function CTABlock({
headline,
description,
buttons,
backgroundColor = 'dark',
}: CTABlockProps) {
const bgClasses: Record<string, string> = {
dark: 'bg-espresso',
light: 'bg-ivory',
accent: 'bg-brass',
}
const firstButton = buttons?.[0]
return (
<section className={cn('relative py-16 md:py-24', bgClasses[backgroundColor || 'dark'])}>
<div className="container relative z-10">
<div className="max-w-3xl mx-auto text-center">
<h2 className={cn(backgroundColor === 'light' ? 'text-espresso' : 'text-soft-white', 'mb-4')}>
{headline}
</h2>
{description && (
<p className={cn(
'text-lg md:text-xl mb-8',
backgroundColor === 'light' ? 'text-espresso/80' : 'text-soft-white/80'
)}>
{description}
</p>
)}
{firstButton && (
<Button
href={firstButton.link}
variant="secondary"
size="lg"
className={cn(
backgroundColor !== 'light' &&
'border-soft-white text-soft-white hover:bg-soft-white hover:text-espresso'
)}
>
{firstButton.text}
</Button>
)}
</div>
</div>
</section>
)
}