import { memo } from "preact/compat"; import { twMerge } from "tailwind-merge"; import Copyright from "../Copyright"; import EmbedNavigation from "../EmbedNavigation"; import ExportMenuButton from "../ExportMenuButton"; import GeolocationButton from "../GeolocationButton"; import LayerTreeButton from "../LayerTreeButton"; import Map from "../Map"; import Overlay from "../Overlay"; import OverlayContent from "../OverlayContent"; import ScaleLine from "../ScaleLine"; import Search from "../Search"; import SearchButton from "../SearchButton"; import ShareMenuButton from "../ShareMenuButton"; import useMapContext from "../utils/hooks/useMapContext"; import ZoomButtons from "../ZoomButtons"; import type { HTMLAttributes } from "preact"; const scrollableHandlerProps = { style: { width: "calc(100% - 60px)" }, }; function MapLayout({ className, ...props }: { className?: string } & HTMLAttributes) { const { hasDetails, hasGeolocation, hasLayerTree, hasPrint, hasRealtime, hasSearch, hasShare, hasToolbar, isEmbed, isOverlayOpen, isSearchOpen, } = useMapContext(); return (
{isEmbed && }
{hasGeolocation && (
)} {!hasToolbar && hasSearch && (
)}
{hasToolbar && (
{hasLayerTree && } {hasPrint && } {hasShare && } {hasSearch && }
{hasSearch && isSearchOpen && (
)}
)} {/* Desktop (>= lg) */} {isOverlayOpen && (
)}
{/* Mobile (< lg) */} {isOverlayOpen && ( )}
); } export default memo(MapLayout);