Skip to content

Commit be315b2

Browse files
refactor(dialog-modal): remove internal disclosure from Modal
1 parent 9e26eae commit be315b2

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/components/ui/dialog-modal.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { cn } from "@/lib/utils/cn"
88
import { Button } from "./buttons/Button"
99
import { Center, Flex } from "./flex"
1010

11-
import { useDisclosure } from "@/hooks/useDisclosure"
12-
1311
const dialogVariant = tv({
1412
slots: {
1513
content:
@@ -163,7 +161,6 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName
163161
export type ModalProps = DialogProps & {
164162
children?: React.ReactNode
165163
title?: React.ReactNode
166-
onClose?: () => void
167164
actionButton?: {
168165
label: string
169166
onClick: () => void
@@ -176,23 +173,10 @@ const Modal = ({
176173
title,
177174
actionButton,
178175
contentProps,
179-
defaultOpen,
180-
onClose,
181176
...restProps
182177
}: ModalProps) => {
183-
const {
184-
onClose: onDisclosureClose,
185-
isOpen,
186-
setValue,
187-
} = useDisclosure(defaultOpen)
188-
189-
const handleClose = () => {
190-
onClose?.()
191-
onDisclosureClose()
192-
}
193-
194178
return (
195-
<Dialog open={isOpen} onOpenChange={setValue} {...restProps}>
179+
<Dialog {...restProps}>
196180
<DialogContent {...contentProps}>
197181
<DialogHeader>
198182
<DialogTitle>{title}</DialogTitle>
@@ -202,7 +186,7 @@ const Modal = ({
202186
<DialogFooter>
203187
<Flex className="justify-end gap-2">
204188
<DialogClose asChild>
205-
<Button onClick={handleClose} variant="outline" isSecondary>
189+
<Button variant="outline" isSecondary>
206190
Cancel
207191
</Button>
208192
</DialogClose>

0 commit comments

Comments
 (0)