complete register form

This commit is contained in:
Alihaghighattalab
2024-08-05 19:58:03 +03:30
parent 5d24b1d5c4
commit d7b66b11a0
4 changed files with 86 additions and 15 deletions
+11 -4
View File
@@ -1,6 +1,6 @@
import { Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions } from '@headlessui/react'
import { ArrowDown2 } from 'iconsax-react'
import { useState } from 'react'
import { FC, useState } from 'react'
const value = [
{ id: 1, name: 'تهران' },
@@ -10,9 +10,13 @@ const value = [
{ id: 5, name: 'تبریز' },
]
export const ComboBox = () => {
type Props = {
field?: any
}
export const ComboBox: FC<Props> = ({ field }) => {
const [query, setQuery] = useState('')
const [selected, setSelected] = useState(value[1])
// const [selected, setSelected] = useState(value[1])
const filteredValue =
query === ''
@@ -22,12 +26,15 @@ export const ComboBox = () => {
})
return (
<Combobox value={selected} onChange={(value: any) => setSelected(value)} onClose={() => setQuery('')}>
<Combobox value={field.value} onChange={field.onChange} onClose={() => setQuery('')}>
<div className="relative w-full">
<ComboboxInput
className="input-style"
displayValue={(person: any) => person?.name}
onChange={(event) => setQuery(event.target.value)}
ref={field.ref}
name={field.name}
onBlur={field.onBlur}
/>
<ComboboxButton className="absolute top-0 h-full bg-transparent">
<ArrowDown2 className="size-5 absolute left-3 top-5 p-0 text-secondary-text-color/70" />