diff --git a/components/home/home-animation-embed.tsx b/components/home/home-animation-embed.tsx index be8796fed..fefe4afb2 100644 --- a/components/home/home-animation-embed.tsx +++ b/components/home/home-animation-embed.tsx @@ -1,3 +1,6 @@ +"use client"; + +import { useEffect, useState } from "react"; import { cn } from "@/lib/utils"; type HomeAnimationEmbedProps = { @@ -15,6 +18,23 @@ export function HomeAnimationEmbed({ 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; } @@ -25,6 +45,7 @@ export function HomeAnimationEmbed({ "overflow-hidden rounded-[24px] border border-black/10 bg-white shadow-[0_10px_24px_rgba(0,0,0,0.05)]", className, )} + onMouseLeave={() => setInteractive(false)} > {title || description ? (