minsik 98680aecf9 - menu link 추가
- modal 위치수정
- logout
2024-09-12 16:21:03 +09:00

27 lines
573 B
JavaScript

'use client'
import { useEffect, useState } from 'react'
import Draggable from 'react-draggable'
export default function WithDraggable({ isShow, children, pos }) {
const [position, setPosition] = useState({ x: 0, y: 0 })
const handleOnDrag = (data) => {
setPosition({ x: data.x, y: data.y })
}
useEffect(() => {
setPosition({ ...pos })
}, [])
return (
<>
{isShow && (
<Draggable position={{ x: position.x, y: position.y }} onDrag={(_, data) => handleOnDrag(data)}>
{children}
</Draggable>
)}
</>
)
}