import type { FC } from 'react' import { CheckCircle } from '@/app/components/base/icons/src/vender/solid/general' type InputProps = { value?: string onChange: (v: string) => void onFocus?: () => void placeholder?: string validated?: boolean className?: string disabled?: boolean type?: string min?: number max?: number } const Input: FC = ({ value, onChange, onFocus, placeholder, validated, className, disabled, type = 'text', min, max, }) => { const toLimit = (v: string) => { const minNum = parseFloat(`${min}`) const maxNum = parseFloat(`${max}`) if (!isNaN(minNum) && parseFloat(v) < minNum) { onChange(`${min}`) return } if (!isNaN(maxNum) && parseFloat(v) > maxNum) onChange(`${max}`) } return (
onChange(e.target.value)} onBlur={e => toLimit(e.target.value)} onFocus={onFocus} value={value} disabled={disabled} type={type} min={min} max={max} /> { validated && (
) }
) } export default Input