modal new fast access

This commit is contained in:
hamid zarghami
2024-12-28 16:47:09 +03:30
parent 50df161858
commit 44d739c061
10 changed files with 275 additions and 64 deletions
+44
View File
@@ -0,0 +1,44 @@
import { FC, SelectHTMLAttributes } from 'react'
export type ItemsSelectType = {
value: string,
label: string,
}
type Props = {
className?: string,
items: ItemsSelectType[],
error_text?: string,
placeholder?: string,
} & SelectHTMLAttributes<HTMLSelectElement>
const Select: FC<Props> = (props: Props) => {
return (
<div className='w-full relative'>
<select {...props} className={`w-full text-black block px-2.5 h-10 text-sm rounded-2.5 bg-gray ${props.className}`}>
{
props.placeholder &&
<option value="" disabled selected>{props.placeholder}</option>
}
{
props.items.map((item) => {
return (
<option key={item.value} value={item.value}>
{item.label}
</option>
)
})
}
</select>
{
props.error_text && props.error_text !== '' ?
<div className='text-xs text-right text-red-600 mt-2 mr-2 font-medium'>
{props.error_text}
</div>
: null
}
</div>
)
}
export default Select