"use client" import { useEffect, useRef, useState } from "react" export default function ConstructionBanner() { const [isVisible, setIsVisible] = useState(false) const bannerRef = useRef(null) // Initialize from sessionStorage useEffect(() => { try { const dismissed = sessionStorage.getItem("constructionBannerDismissed") === "1" setIsVisible(!dismissed) } catch { // If sessionStorage is unavailable, default to showing the banner setIsVisible(true) } }, []) // Manage root class and CSS var for offset while visible useEffect(() => { const root = document.documentElement if (!isVisible) { root.classList.remove("has-site-banner") root.style.removeProperty("--site-banner-height") return } root.classList.add("has-site-banner") const updateBannerHeight = () => { const height = bannerRef.current?.offsetHeight ?? 0 root.style.setProperty("--site-banner-height", `${height}px`) } updateBannerHeight() window.addEventListener("resize", updateBannerHeight) return () => { window.removeEventListener("resize", updateBannerHeight) } }, [isVisible]) if (!isVisible) { return null } return (
🚧 Site Under Construction.{" "} For bookings, call {" "} 719-698-9004
) }