Skip to content

Commit 1338125

Browse files
Refactor modal to have backdrop
Add backdrop to Modal, since we want to have the backdrop on every modal. Also minor cleanup to the styles, so now we use simple flexbox attributes instead of translate-x & y attributes.
1 parent 9f01a12 commit 1338125

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ui/src/uiComponents/modal/Modal.tsx

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Dialog } from '@headlessui/react';
22
import React from 'react';
3+
import { twMerge } from 'tailwind-merge';
34

45
interface Props {
56
isOpen: boolean;
@@ -20,9 +21,18 @@ export const Modal: React.FC<Props> = ({
2021
open={isOpen}
2122
data-testid={testId}
2223
onClose={onClose}
23-
className={`fixed top-1/2 left-1/2 z-10 -translate-y-1/2 -translate-x-1/2 overflow-y-auto bg-white drop-shadow-md ${className}`}
24+
className="relative z-50"
2425
>
25-
{children}
26+
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50">
27+
<div
28+
className={twMerge(
29+
'overflow-y-auto bg-white drop-shadow-md',
30+
className,
31+
)}
32+
>
33+
{children}
34+
</div>
35+
</div>
2636
</Dialog>
2737
);
2838
};

0 commit comments

Comments
 (0)