add by me coffee
This commit is contained in:
@@ -10,6 +10,7 @@ export interface ModalProps {
|
||||
children?: ReactNode
|
||||
onClose?: () => void
|
||||
title: string
|
||||
showCloseIcon?: boolean
|
||||
className?: string
|
||||
}
|
||||
|
||||
@@ -17,7 +18,7 @@ const Modal = React.forwardRef<
|
||||
React.ElementRef<typeof DialogPrimitive.Root>,
|
||||
ModalProps
|
||||
>((props, forwardedRef) => {
|
||||
const { show, children, onClose, className, title } = props
|
||||
const { show, children, onClose, className, title, showCloseIcon } = props
|
||||
const [_, setAppState] = useRecoilState(appState)
|
||||
|
||||
const onOpenChange = (open: boolean) => {
|
||||
@@ -39,7 +40,11 @@ const Modal = React.forwardRef<
|
||||
>
|
||||
<div className="modal-header">
|
||||
<DialogPrimitive.Title>{title}</DialogPrimitive.Title>
|
||||
<Button icon={<XIcon />} onClick={onClose} />
|
||||
{showCloseIcon ? (
|
||||
<Button icon={<XIcon />} onClick={onClose} />
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</div>
|
||||
{children}
|
||||
</DialogPrimitive.Content>
|
||||
@@ -48,4 +53,8 @@ const Modal = React.forwardRef<
|
||||
)
|
||||
})
|
||||
|
||||
Modal.defaultProps = {
|
||||
showCloseIcon: true,
|
||||
}
|
||||
|
||||
export default Modal
|
||||
|
||||
Reference in New Issue
Block a user