58 lines
No EOL
1.4 KiB
TypeScript
58 lines
No EOL
1.4 KiB
TypeScript
import React from 'react';
|
|
|
|
interface DialogProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export function Dialog({ open, onOpenChange, children }: DialogProps) {
|
|
if (!open) {return null;}
|
|
|
|
return (
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
{/* Backdrop */}
|
|
<div
|
|
className="fixed inset-0 bg-black/50 backdrop-blur-sm"
|
|
onClick={() => onOpenChange(false)}
|
|
/>
|
|
{/* Dialog */}
|
|
<div className="relative z-50 max-h-[90vh] overflow-auto">
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface DialogContentProps {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
export function DialogContent({ children, className = '' }: DialogContentProps) {
|
|
return (
|
|
<div
|
|
className={`bg-surface border border-border rounded-lg shadow-lg p-6 w-full ${className}`}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface DialogHeaderProps {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
export function DialogHeader({ children, className = '' }: DialogHeaderProps) {
|
|
return <div className={`mb-4 ${className}`}>{children}</div>;
|
|
}
|
|
|
|
interface DialogTitleProps {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
export function DialogTitle({ children, className = '' }: DialogTitleProps) {
|
|
return <h2 className={`text-lg font-semibold text-text-primary ${className}`}>{children}</h2>;
|
|
} |