import type { WysiwygBlock } from "@/types/sections";
import { useLocale } from "@/i18n/LocaleContext";

export function Wysiwyg({ block }: { block: WysiwygBlock }) {
  const { t } = useLocale();
  return (
    <section className="py-12 md:py-16">
      <div className="container max-w-3xl">
        {block.title && (
          <h2 className="font-display italic text-3xl text-primary mb-6">{t(block.title)}</h2>
        )}
        <div
          className="prose prose-neutral max-w-none text-foreground/85"
          // Content originates from us in Phase 1; WP will sanitize in Phase 2.
          dangerouslySetInnerHTML={{ __html: t(block.content) }}
        />
      </div>
    </section>
  );
}