35 lines
854 B
TypeScript
35 lines
854 B
TypeScript
"use client";
|
|
|
|
import { X } from "lucide-react";
|
|
import { Button } from "./button";
|
|
|
|
export function Modal({
|
|
title,
|
|
open,
|
|
onClose,
|
|
children
|
|
}: {
|
|
title: string;
|
|
open: boolean;
|
|
onClose: () => void;
|
|
children: React.ReactNode;
|
|
}) {
|
|
if (!open) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4">
|
|
<div className="glass max-h-[92vh] w-full max-w-2xl overflow-y-auto rounded-2xl p-6">
|
|
<div className="mb-5 flex items-center justify-between gap-4">
|
|
<h2 className="text-xl font-semibold">{title}</h2>
|
|
<Button type="button" variant="ghost" className="h-10 w-10 rounded-full p-0" onClick={onClose} aria-label="Close">
|
|
<X className="h-5 w-5" />
|
|
</Button>
|
|
</div>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|