import { useMessage } from '@/hooks/useMessage'
import WithDraggable from '@/components/common/draggable/WithDraggable'
import { usePopup } from '@/hooks/usePopup'
import { useRecoilValue } from 'recoil'
import { contextPopupPositionState } from '@/store/popupAtom'
import { useCanvas } from '@/hooks/useCanvas'

export default function AuxiliarySize(props) {
  const contextPopupPosition = useRecoilValue(contextPopupPositionState)
  const { id, pos = contextPopupPosition } = props
  const { getMessage } = useMessage()
  const { closePopup } = usePopup()
  const { currentObject } = useCanvas()
  return (
    <WithDraggable isShow={true} pos={pos}>
      <div className={`modal-pop-wrap xm mount`}>
        <div className="modal-head modal-handle">
          <h1 className="title">{getMessage('modal.auxiliary.size.edit')} </h1>
          <button className="modal-close" onClick={() => closePopup(id)}>
            닫기
          </button>
        </div>
        <div className="modal-body">
          <div className="discrimination-box mb10">
            <div className="d-check-radio pop mb10">
              <input type="radio" name="radio01" id="ra01" />
              <label htmlFor="ra01">1{getMessage('modal.auxiliary.size.edit.point')}</label>
            </div>
            <div className="outline-form mb15">
              <div className="input-grid mr5" style={{ flex: '1 1 auto' }}>
                <input type="text" className="input-origin block" defaultValue={currentObject?.length} readOnly={true} />
              </div>
              <span className="thin">mm</span>
            </div>
            <div className="outline-form">
              <span style={{ width: 'auto' }}>{getMessage('length')}</span>
              <div className="input-grid mr5">
                <input type="text" className="input-origin block" defaultValue={100} />
              </div>
              <span className="thin">mm</span>
            </div>
          </div>
          <div className="discrimination-box ">
            <div className="d-check-radio pop mb10">
              <input type="radio" name="radio01" id="ra02" />
              <label htmlFor="ra02">2{getMessage('modal.auxiliary.size.edit.point')}</label>
            </div>
            <div className="outline-form mb15">
              <div className="input-grid mr5" style={{ flex: '1 1 auto' }}>
                <input type="text" className="input-origin block" defaultValue={100} readOnly={true} />
              </div>
              <span className="thin">mm</span>
            </div>
            <div className="outline-form">
              <span style={{ width: 'auto' }}>{getMessage('length')}</span>
              <div className="input-grid mr5">
                <input type="text" className="input-origin block" defaultValue={currentObject?.length} readOnly={true} />
              </div>
              <span className="thin">mm</span>
            </div>
          </div>
          <div className="grid-btn-wrap">
            <button className="btn-frame modal act">{getMessage('modal.common.save')}</button>
          </div>
        </div>
        <div className="modal-foot modal-handle"></div>
      </div>
    </WithDraggable>
  )
}
