import { ComponentConfig } from "@reacteditor/core"; import { Megaphone } from "lucide-react"; import { cn } from "~/editor/lib/utils"; export type BannerProps = { text: string; ctaLabel: string; ctaHref: string; tone: "default" | "inverse" | "muted"; }; function Banner({ text, ctaLabel, ctaHref, tone }: BannerProps) { const toneClass: Record = { default: "bg-foreground text-background", inverse: "bg-background text-foreground border-y border-border", muted: "bg-muted text-foreground border-y border-border", }; return (
{text} {ctaLabel ? ( {ctaLabel} → ) : null}
); } export const bannerEditor: ComponentConfig = { label: "Announcement bar", icon: , category: "hero", defaultProps: { text: "Free shipping on orders over $150", ctaLabel: "Shop new", ctaHref: "/collections/new", tone: "default", }, fields: { text: { label: "Text", type: "text", contentEditable: true }, ctaLabel: { label: "CTA label", type: "text", contentEditable: true }, ctaHref: { label: "CTA link", type: "text" }, tone: { label: "Tone", type: "select", options: [ { label: "Default (dark)", value: "default" }, { label: "Inverse (light)", value: "inverse" }, { label: "Muted", value: "muted" }, ], }, }, render: (props) => , };