Skip to content

Commit

Permalink
Merge pull request #17 from broadlume/bugfix/BL-6797-added-support-fo…
Browse files Browse the repository at this point in the history
…r-modal-close

[BL-6797] Modal onClose fixes
  • Loading branch information
isrodela authored Nov 5, 2024
2 parents 383fe0d + ef9b33e commit 0f78df1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@broadlume/willow-ui",
"main": "./src/index.ts",
"version": "0.0.5",
"version": "0.0.6",
"author": {
"name": "dreadhalor",
"url": "https://scotthetrick.com"
Expand Down
7 changes: 5 additions & 2 deletions src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;

const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
onClose?: () => void;
}
>(({ className, children, onClose = () => null, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
Expand All @@ -61,6 +63,7 @@ const DialogContent = React.forwardRef<
'~ring-offset-background focus:~outline-none focus:~ring-2 focus:~ring-ring focus:~ring-offset-2',
'data-[state=open]:~bg-accent data-[state=open]:~text-muted-foreground'
)}
onClick={onClose}
>
<Cross2Icon className='~h-4 ~w-4' />
<span className='~sr-only'>Close</span>
Expand Down

0 comments on commit 0f78df1

Please sign in to comment.