Skip to content

Commit

Permalink
feat(Modal): adding prop className to ModalClose (#372)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Style**
- Enhanced the styling capability of the modal close component by
introducing a class name property.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
aversini authored Mar 5, 2024
1 parent 013982d commit fbadadb
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 fbadadb

Please sign in to comment.