fix: add disabled attribute in QSelectBox

This commit is contained in:
yoosangwook 2024-10-30 13:16:52 +09:00
parent 2ca8b84f17
commit 8784c1eeb7
3 changed files with 10884 additions and 558 deletions

10656
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
'use client'
import { useEffect, useState } from 'react'
export default function QSelectBox({ title = '', options, onChange, value }) {
export default function QSelectBox({ title = '', options, onChange, value, disabled = false }) {
const [openSelect, setOpenSelect] = useState(false)
const [selected, setSelected] = useState(title === '' ? options[0].name : title)
@ -15,7 +15,7 @@ export default function QSelectBox({ title = '', options, onChange, value }) {
}, [value])
return (
<div className={`sort-select ${openSelect ? 'active' : ''}`} onClick={() => setOpenSelect(!openSelect)}>
<div className={`sort-select ${openSelect ? 'active' : ''}`} onClick={disabled ? () => {} : () => setOpenSelect(!openSelect)}>
<p>{selected}</p>
<ul className="select-item-wrap">
{options?.map((option) => (

782
yarn.lock

File diff suppressed because it is too large Load Diff