24 lines
590 B
TypeScript
24 lines
590 B
TypeScript
import type { ReactNode } from 'react'
|
|
import { Overlay } from './Overlay'
|
|
|
|
interface DrawerProps {
|
|
open: boolean
|
|
onClose: () => void
|
|
title?: string
|
|
children: ReactNode
|
|
}
|
|
|
|
export function Drawer({ open, onClose, title, children }: DrawerProps) {
|
|
return (
|
|
<Overlay
|
|
open={open}
|
|
onClose={onClose}
|
|
position="right"
|
|
className="h-full w-full max-w-sm overflow-y-auto bg-white p-6 shadow-xl dark:bg-gray-900"
|
|
>
|
|
{title && <h2 className="mb-4 text-lg font-semibold text-gray-900 dark:text-gray-100">{title}</h2>}
|
|
{children}
|
|
</Overlay>
|
|
)
|
|
}
|