import { useEffect, useState } from "react"; import Button3 from "./Button3"; import CloseIcon from "./icons/CloseIcon"; interface Props { sidebarComponent: { element: JSX.Element; name: "Floor" | "Rooftop" | "Sky Garden" | "Podium Level" | "Ground Level"; desc?: string; } | null; onClose: () => void; } function FloorSidebarContainer({ sidebarComponent, onClose }: Props) { const [component, setComponent] = useState(sidebarComponent); useEffect(() => { if (!sidebarComponent) return; setComponent(sidebarComponent); }, [sidebarComponent]); return (
{component?.name === "Floor" ? `${component.element.props.floor} floor` : component?.name}
{component?.desc}