"use client"; import { useEffect, useState } from "react"; import { cn } from "@/lib/utils"; type HomeAnimationEmbedProps = { htmlContent: string; title?: string; description?: string; className?: string; frameClassName?: string; }; export function HomeAnimationEmbed({ htmlContent, title, description, className, frameClassName, }: HomeAnimationEmbedProps) { const [interactive, setInteractive] = useState(false); useEffect(() => { if (!interactive) { return; } const handleKeyDown = (event: KeyboardEvent) => { if (event.key === "Escape") { setInteractive(false); } }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); }, [interactive]); if (!htmlContent.trim()) { return null; } return (
setInteractive(false)} > {title || description ? (
{title ? (
{title}
) : null} {description ? (
{description}
) : null}
) : null}