import { ComponentConfig } from "@reacteditor/core"; import { Megaphone } from "lucide-react"; import { cn } from "~/editor/lib/utils"; import { Typography } from "~/editor/theme/Typography"; export type CTAProps = { tagline: string; heading: string; subheading: string; primaryCta: { label: string; href: string }; secondaryCta: { label: string; href: string }; imageUrl: string; align: "left" | "center"; }; function CTA({ tagline, heading, subheading, primaryCta, secondaryCta, imageUrl, align, }: CTAProps) { return (
{imageUrl ? ( <>
) : (
)}
{tagline ? (

{tagline}

) : null} {heading} {subheading ? ( {subheading} ) : null}
{primaryCta?.label ? ( {primaryCta.label} ) : null} {secondaryCta?.label ? ( {secondaryCta.label} ) : null}
); } export const ctaEditor: ComponentConfig = { label: "Call to action", icon: , category: "content", defaultProps: { tagline: "", heading: "Designed once. Worn for years.", subheading: "Join 40,000 people building a wardrobe they actually reach for.", primaryCta: { label: "Shop now", href: "/collections" }, secondaryCta: { label: "Read our story", href: "/about" }, imageUrl: "https://images.unsplash.com/photo-1483985988355-763728e1935b?auto=format&fit=crop&w=2400&q=80", align: "center", }, fields: { tagline: { label: "Tagline", type: "text", contentEditable: true }, heading: { label: "Heading", type: "textarea", contentEditable: true }, subheading: { label: "Subheading", type: "textarea", contentEditable: true }, primaryCta: { label: "Primary CTA", type: "object", objectFields: { label: { label: "Label", type: "text", contentEditable: true }, href: { label: "Link", type: "text" }, }, }, secondaryCta: { label: "Secondary CTA", type: "object", objectFields: { label: { label: "Label", type: "text", contentEditable: true }, href: { label: "Link", type: "text" }, }, }, imageUrl: { label: "Background image URL", type: "text" }, align: { label: "Alignment", type: "radio", options: [ { label: "Left", value: "left" }, { label: "Center", value: "center" }, ], }, }, render: (props) => , };