diff --git a/src/app/page.tsx b/src/app/page.tsx index 678b6c5..2e344e1 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,7 +1,28 @@ -import { ChevronDown, ChevronUp, MessageSquareMore, PencilLine, Share2 } from "lucide-react"; +/* eslint-disable tailwindcss/no-custom-classname */ +"use client"; + +import { ChevronDown, ChevronUp, CircleX, MessageSquareMore, PencilLine, Share2 } from "lucide-react"; import Image from "next/image"; +import { useEffect, useState } from "react"; export default function Home() { + const [image, imageState] = useState(false); + + useEffect(() => { + const handleOutsideClick = (event: MouseEvent) => { + const target = event.target; + if (image && target instanceof HTMLElement && !target.closest(".image-container")) { + imageState(false); + } + }; + + document.addEventListener("mousedown", e => handleOutsideClick(e)); + + return () => { + document.removeEventListener("mousedown", handleOutsideClick); + }; + }, [image]); + return ( <>