'use client' import { useState } from 'react' import Draggable from 'react-draggable' import PopSpinner from '../spinner/PopSpinner' import { popSpinnerState } from '@/store/popupAtom' import { useRecoilState } from 'recoil' export default function WithDraggable({ isShow, children, pos = { x: 0, y: 0 }, handle = '', className = '', hasFooter = true, isHidden = false }) { const [position, setPosition] = useState(pos) const [popSpinnerStore, setPopSpinnerStore] = useRecoilState(popSpinnerState) const handleOnDrag = (e, data) => { e.stopPropagation() setPosition({ x: data.x, y: data.y }) } // useEffect(() => { // setPosition({ ...pos }) // }, []) return ( <> {isShow && ( handleOnDrag(e, data)} handle="" //{handle === '' ? '.modal-handle' : handle} //전체 handle cancel="input, button, select, textarea, [contenteditable], .sort-select" >
{children} {hasFooter && } {popSpinnerStore && }
)} ) } function WithDraggableHeader({ title, onClose, children, isFold, onFold = null }) { return (

{title}

{onFold && } {onClose && ( )}
) } function WithDraggableBody({ children }) { return (
<>{children}
) } function WithDraggableFooter() { return
} WithDraggable.Header = WithDraggableHeader WithDraggable.Body = WithDraggableBody WithDraggable.Footer = WithDraggableFooter