'use client'
import { useState } from "react"

export default function Qselect({title, option, disabled}){
    const [selectAct, setSelectAct] = useState(false);

    const disabledCheck = () => {
        if(disabled){
            setSelectAct(false)
        }else{
            setSelectAct(!selectAct);
        }
    }
    return(
        <div className={`sort-select ${selectAct ? 'active' : ''} ${disabled ? 'disabled' : ''}`} onClick={disabledCheck}>
            <p>{title}</p>
            <ul className="select-item-wrap">
                {option.map((el, idx) => (
                    <li key={idx} className="select-item">
                        <button>{el.name}</button>
                    </li>
                ))}
            </ul>
        </div>
    )
}