'use client' import { useContext, useRef } from 'react' import { Dialog, Modal, ModalOverlay } from 'react-aria-components' import { IconButton } from '../IconButton' import { MaterialIcon } from '../Icons/MaterialIcon' import { Typography } from '../Typography' import { SidePeekContext } from './SidePeekContext' import SidePeekSEO from './SidePeekSEO' import styles from './sidePeek.module.css' interface SidePeekProps { contentKey?: string title: string isOpen?: boolean openInRoot?: boolean handleClose?: (isOpen: boolean) => void closeLabel: string } export default function SidePeek({ children, title, contentKey, handleClose, isOpen, openInRoot = false, closeLabel, }: React.PropsWithChildren) { const rootDiv = useRef(null) const context = useContext(SidePeekContext) function onClose() { const closeHandler = handleClose || context?.handleClose closeHandler?.(false) } return ( <>
{children} ) }