-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDialog.tsx
More file actions
36 lines (34 loc) · 1.36 KB
/
Dialog.tsx
File metadata and controls
36 lines (34 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as RadDialog from '@radix-ui/react-dialog';
import { ReactNode } from "react";
interface DialogProps {
button: ReactNode;
children: ReactNode;
description?: ReactNode;
title: ReactNode;
}
export function Dialog({ button, children, description, title }: DialogProps) {
return (
<RadDialog.Root>
<RadDialog.Trigger asChild>
{button}
</RadDialog.Trigger>
<RadDialog.Portal>
<RadDialog.Overlay className='DialogOverlay backdrop-blur fixed inset-0' />
<RadDialog.Content className='DialogContent fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-[#111329] py-5 pl-5 pr-8 text-white rounded-md drop-shadow-xl'>
<div className='mb-8'>
<RadDialog.Title className='font-bold text-xl'>{title}</RadDialog.Title>
<RadDialog.Description className="text-gray-300">
{description && description}
</RadDialog.Description>
</div>
{children}
<RadDialog.Close asChild className='mt-2 absolute right-4 top-2'>
<button aria-label="Close">
X
</button>
</RadDialog.Close>
</RadDialog.Content>
</RadDialog.Portal>
</RadDialog.Root>
)
}