'use client'
import WithDraggable from "@/components/common/draggable/withDraggable";
import Image from "next/image";
import { useState } from "react";
import ShapeTab01 from "./ShapeTab01";
import ShapeTab02 from "./ShapeTab02";
import ShapeTab03 from "./ShapeTab03";
import ShapeTab04 from "./ShapeTab04";
import ShapeTabPosition from "./ShapeTabPosition";

const shapeMenu = [
    {id:1, name:'龍丸屋根'},
    {id:2, name:'Aパターン'},
    {id:3, name:'Bパターン'},
    {id:4, name:'別に設定'},
    {id:5, name:'立つ'},
    {id:6, name:'ドン'},
    {id:7, name:'M'},
    {id:8, name:'北'},
]
export default function RoofShapeOption() {
    const [shapeNum, setShapeNum] = useState(1);
    return(
        <WithDraggable isShow={true}>
            <div className={`modal-pop-wrap lr`}>
                <div className="modal-head">
                <h1 className="title">屋根形状の設定</h1>
                    <button className="modal-close">닫기</button>
                </div>
                <div className="modal-body">
                    <div className="roof-shape-menu">
                        {shapeMenu.map((item) => (
                            <button key={item.id} className={`shape-menu-box ${shapeNum === item.id ? 'act': ''}`} onClick={() => setShapeNum(item.id)}>
                                <div className="shape-box">
                                    <Image src={`/static/images/canvas/shape_menu0${item.id}.svg`} alt="react" width={64} height={64} />
                                </div>
                                <div className="shape-title">{item.name}</div>
                            </button>
                        ))}
                    </div>
                    <div className="properties-setting-wrap">
                        <div className="setting-tit">設定</div>
                        {shapeNum === 1 && <ShapeTab01/>}
                        {shapeNum === 2 && <ShapeTab02/>}
                        {shapeNum === 3 && <ShapeTab03/>}
                        {shapeNum === 4 && <ShapeTab04/>}
                        {(shapeNum === 5 || shapeNum === 6 || shapeNum === 7 || shapeNum === 8) && <ShapeTabPosition/>}
                    </div>
                    <div className="grid-btn-wrap">
                        <button className="btn-frame modal act">設定完了</button>
                    </div>
                </div>
            </div>
        </WithDraggable>
    )
}