Spaces:
Running
Running
File size: 773 Bytes
9cd6ddb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
export const Input = ({
type = "string",
value,
className,
prefix,
placeholder,
onChange,
}: {
type?: string;
placeholder?: string;
prefix?: string;
className?: string;
value?: string | number;
onChange: (e: string | number) => void;
}) => {
return type === "textarea" ? (
<textarea
className={`${className} outline-none w-full min-h-[120px] block`}
placeholder={placeholder}
value={value}
onChange={({ target }) => onChange(target.value)}
/>
) : (
<input
type={type}
className={`${className} outline-none w-full`}
placeholder={placeholder}
value={value}
onChange={({ target }) =>
onChange(type === "number" ? Number(target.value) : target.value)
}
/>
);
};
|