fix: add disabled attribute in QSelectBox
This commit is contained in:
parent
2ca8b84f17
commit
8784c1eeb7
10656
package-lock.json
generated
Normal file
10656
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -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) => (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user