Files
av-planner/src/components/common/Modal.tsx
T

28 lines
854 B
TypeScript

import type { ReactNode } from 'react'
export default function Modal({
title,
onClose,
children,
width = 'max-w-lg',
}: {
title: string
onClose: () => void
children: ReactNode
width?: string
}) {
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4">
<div className={`flex max-h-[85vh] w-full ${width} flex-col rounded-lg bg-white shadow-xl`}>
<div className="flex items-center justify-between border-b border-slate-200 px-4 py-3">
<h3 className="text-sm font-semibold text-slate-800">{title}</h3>
<button onClick={onClose} className="rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-600">
✕
</button>
</div>
<div className="overflow-y-auto px-4 py-3">{children}</div>
</div>
</div>
)
}