import React from 'react' import { Button } from '@/core/components/ui/button' import { buildSectionClasses } from '@/core/types/blocks' import type { CTASectionBlockProps } from './schema' /** * CTA Section Block Component * * Props from 3-tab structure: * - Content: title, content, cta (primary), secondaryButton * - Design: backgroundColor * - Advanced: className, id */ export function CTASectionBlock({ // Base content props title, content, cta, // CTA-specific content secondaryButton, // Base design props backgroundColor, // Base advanced props className, id, // Legacy props for backward compatibility ...legacyProps }: CTASectionBlockProps & { buttonText?: string buttonLink?: string primaryButton?: { text: string; link: string; variant?: string } description?: string }) { // Handle legacy format (buttonText/buttonLink or primaryButton) const primaryCta = cta || (legacyProps.primaryButton ? { text: legacyProps.primaryButton.text, link: legacyProps.primaryButton.link, target: '_self' as const, } : legacyProps.buttonText ? { text: legacyProps.buttonText, link: legacyProps.buttonLink || '#', target: '_self' as const, } : undefined) // Handle legacy description prop const displayContent = content || (legacyProps as { description?: string }).description // Build section classes with background and custom className const sectionClasses = buildSectionClasses( 'py-16 px-4 @md:py-24', { backgroundColor, className } ) return (
{title && (

{title}

)} {displayContent && (

{displayContent}

)} {(primaryCta || secondaryButton) && (
{primaryCta && ( )} {secondaryButton && ( )}
)}
) }