fix: control modal head props

This commit is contained in:
yoosangwook 2024-10-02 13:19:48 +09:00
parent f8b0485479
commit 98a2589aa8

View File

@ -3,7 +3,7 @@
import { useState } from 'react'
import Draggable from 'react-draggable'
export default function WithDraggable({ isShow, children }) {
export default function WithDraggable({ isShow, handle = '', children }) {
const [position, setPosition] = useState({ x: 0, y: 0 })
const handleOnDrag = (data) => {
@ -13,7 +13,11 @@ export default function WithDraggable({ isShow, children }) {
return (
<>
{isShow && (
<Draggable position={{ x: position.x, y: position.y }} onDrag={(_, data) => handleOnDrag(data)} handle=".modal-header">
<Draggable
position={{ x: position.x, y: position.y }}
onDrag={(_, data) => handleOnDrag(data)}
handle={handle === '' ? '.modal-head' : handle}
>
{children}
</Draggable>
)}