Skip to content

Commit

Permalink
feat(Modal): adding prop className to ModalClose
Browse files Browse the repository at this point in the history
  • Loading branch information
aversini committed Mar 4, 2024
1 parent 013982d commit 92e5070
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/ui-private/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,19 @@ export const ModalClose = React.forwardRef<
HTMLButtonElement,
{
trigger: React.ReactElement;
className?: string;
}
>(function ModalClose(props, ref) {
const { setOpen } = useModalContext();
const { trigger, ...rest } = props;
const { trigger, className, ...rest } = props;
const handleClose = React.useCallback(() => setOpen(false), [setOpen]);
return (
<>
<div className={className}>
{React.cloneElement(trigger, {
ref,
onClick: handleClose,
...rest,
})}
</>
</div>
);
});

0 comments on commit 92e5070

Please sign in to comment.