import { LegalShell } from "@/components/legal/legal-shell";
import { ProductDescription } from "@/components/store/product-description";
import { SanityPortableTextBlock } from "@/lib/sanity/queries";

type Props = {
  eyebrow: string;
  title: string;
  description: string;
  richContent?: SanityPortableTextBlock[] | null;
  fallbackHtml?: string;
};

export function LegalPageContent({ eyebrow, title, description, richContent, fallbackHtml }: Props) {
  const hasRichContent = Array.isArray(richContent) && richContent.length > 0;

  return (
    <LegalShell eyebrow={eyebrow} title={title} description={description}>
      {hasRichContent ? <ProductDescription richBlocks={richContent} /> : <div dangerouslySetInnerHTML={{ __html: fallbackHtml || "" }} />}
    </LegalShell>
  );
}
