'use client'

import { useState } from 'react'
import SuitableCheckData from './SuitableCheckData'
import SuitableNoData from './SuitableNoData'
import Image from 'next/image'

export default function Suitable() {
  const [reference, setReference] = useState(false)

  return (
    <div className="border-frame">
      <div className="sale-form-bx">
        <select className="select-form" name="" id="">
          <option value="">屋根材を選択してください.</option>
          <option value="">屋根材を選択してください.</option>
          <option value="">屋根材を選択してください.</option>
          <option value="">屋根材を選択してください.</option>
          <option value="">屋根材を選択してください.</option>
        </select>
      </div>
      <div className="sale-form-bx">
        <div className="search-input">
          <input type="text" className="search-frame" placeholder="屋根材 製品名を入力してください." />
          <button className="search-icon"></button>
        </div>
      </div>
      <div className="compliance-check-wrap">
        <div className={`compliance-check-bx ${reference ? 'act' : ''}`}>
          <div className="check-name-wrap">
            <div className="check-name">凡例</div>
            <div className="check-name-btn">
              <button className="bx-btn" onClick={() => setReference(!reference)}></button>
            </div>
          </div>
          <ul className="reference-list">
            <li className="reference-item">
              <div className="reference-item-bx">
                <div className="compliance-icon">
                  <Image src={'/assets/images/sub/compliance_check_icon.svg'} width={22} height={22} alt=""></Image>
                </div>
                <span>設置可能</span>
              </div>
            </li>
            <li className="reference-item">
              <div className="reference-item-bx">
                <div className="compliance-icon">
                  <Image src={'/assets/images/sub/compliance_x_icon.svg'} width={22} height={22} alt=""></Image>
                </div>
                <span>設置不可</span>
              </div>
            </li>
            <li className="reference-item">
              <div className="reference-item-bx">
                <div className="compliance-icon">
                  <Image src={'/assets/images/sub/compliance_quest_icon.svg'} width={22} height={22} alt=""></Image>
                </div>
                <span>お問い合わせ</span>
              </div>
            </li>
            <li className="reference-item">
              <div className="reference-item-bx">
                <div className="compliance-icon">
                  <Image src={'/assets/images/sub/compliance_tip_icon.svg'} width={22} height={22} alt=""></Image>
                </div>
                <span>備考</span>
              </div>
            </li>
          </ul>
        </div>
        {/* checkData */}
        {/* 데이터 없을경우 버튼 영역 안보여야함 */}
        <SuitableCheckData />
        <SuitableCheckData />
        <SuitableCheckData />
        <SuitableCheckData />

        {/* 데이터 없을경우 버튼 영역 안보여야함 */}
        <div className="float-btn-wrap">
          <div className="btn-flex-wrap com">
            <div className="btn-bx">
              <button className="btn-frame n-blue icon">
                全選択<i className="btn-arr"></i>
              </button>
            </div>
            <div className="btn-bx">
              <button className="btn-frame red icon">
                詳細を見る<i className="btn-arr"></i>
              </button>
            </div>
            <div className="btn-bx">
              <button className="btn-frame n-blue icon">
                選択ダウンロード<i className="btn-arr"></i>
              </button>
            </div>
          </div>
        </div>
      </div>

      {/* 검색기록 없을떄 위에 두 영역 안보이고 이 부분만 보여야 함*/}
      {/* <SuitableNoData /> */}
    </div>
  )
}
