diff --git a/packages/ui-components/src/components/Panel/Panel.tsx b/packages/ui-components/src/components/Panel/Panel.tsx index a99c7459..83ee3915 100644 --- a/packages/ui-components/src/components/Panel/Panel.tsx +++ b/packages/ui-components/src/components/Panel/Panel.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef } from "react"; -import { IconClose } from "../"; +import { ButtonIcon, IconClose } from "../"; import { Modal, ModalClose, @@ -44,9 +44,13 @@ export const Panel = ({ - - - + + + + } + >
{title}
diff --git a/packages/ui-components/src/components/private/Modal/Modal.tsx b/packages/ui-components/src/components/private/Modal/Modal.tsx index f27a6e94..87427bed 100644 --- a/packages/ui-components/src/components/private/Modal/Modal.tsx +++ b/packages/ui-components/src/components/private/Modal/Modal.tsx @@ -7,7 +7,7 @@ import { import clsx from "clsx"; import * as React from "react"; -import { ButtonIcon, useUniqueId } from "../.."; +import { useUniqueId } from "../.."; import { ModalContext } from "./ModalContext"; import { useModal, useModalContext } from "./ModalHooks"; import type { ModalOptions } from "./ModalTypes"; @@ -106,22 +106,19 @@ export const ModalDescription = React.forwardRef< export const ModalClose = React.forwardRef< HTMLButtonElement, { - children?: React.ReactNode; + trigger: React.ReactElement; } >(function ModalClose(props, ref) { const { setOpen } = useModalContext(); - const { children, ...rest } = props; + const { trigger, ...rest } = props; const handleClose = React.useCallback(() => setOpen(false), [setOpen]); return ( - - {children} - + <> + {React.cloneElement(trigger, { + ref, + onClick: handleClose, + ...rest, + })} + ); });