Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui/src/components/modal/modal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
left: 0;
width: 100%;
height: 100%;
z-index: 1;
z-index: 0;
inset: 0;
background-color: color-mix(
in srgb,
Expand Down
31 changes: 17 additions & 14 deletions packages/ui/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const Modal = forwardRef<HTMLDivElement, ModalProps>(
open={open}
onClose={onClose}
slots={{
backdrop: (props) => <Backdrop {...props} onClose={onClose} />,
backdrop: Backdrop,
}}
>
<Fade in={open}>
Expand Down Expand Up @@ -112,23 +112,26 @@ export const Modal = forwardRef<HTMLDivElement, ModalProps>(
/**
* Backdrop component for the modal that dims the background
*/
const Backdrop = forwardRef<
HTMLDivElement,
{ open?: boolean; className: string; onClose?: () => void }
>((props, ref) => {
const { open, className, onClose } = props;
const Backdrop = forwardRef<HTMLDivElement, BackdropProps>((props, ref) => {
const { open, className } = props;

return (
<Fade in={open}>
<div className={clsx(styles['backdrop'], className)} ref={ref}>
{onClose && (
<button
onClick={onClose}
className={styles['backdrop-close']}
type="button"
/>
<div
{...props}
ref={ref}
className={clsx(
{ 'base-Backdrop-open': open },
styles['backdrop'],
className,
)}
</div>
/>
</Fade>
);
});

type BackdropProps = {
open?: boolean;
className: string;
onClose?: () => void;
};