import { useEffect, useRef, useState } from "@wordpress/element"; import { toggleEqualHeight } from "../shared/helpFn"; import { breakpoint } from "../../controls/controls"; import TemplateOne from "../shared/templates/templateCards/templateOne"; const Render = ({ attributes, posts }) => { const { timelineLayout, contentVerticalPosition, equalHeightEnable, uniqueId, catTabCategoryPosition } = attributes; const containerRef = useRef(null); // Equalizing the post cards height. useEffect(() => { setTimeout(() => { toggleEqualHeight(uniqueId, equalHeightEnable); }, 50); }, [equalHeightEnable, uniqueId, posts]); const [selectedPostId, setSelectedPostId] = useState(null); useEffect(() => { const handleClickOutside = (event) => { if (containerRef.current && !containerRef.current.contains(event.target)) { setSelectedPostId(null); } }; document.addEventListener("mousedown", handleClickOutside); return () => document.removeEventListener("mousedown", handleClickOutside); }, []); return (