Files
rick-and-morty/src/components/field/field.tsx
2024-05-11 14:39:59 +03:00

19 lines
510 B
TypeScript

import React from "react";
import { FieldInput, FieldLabel, FieldWrapper } from "./field.style";
export const InputField = ({ id, placeHolder, value, label, onChange, inputRef }) => {
return (
<FieldWrapper>
<FieldLabel htmlFor={id}>
{label}
</FieldLabel>
<FieldInput ref={inputRef} id={id} type="text" placeholder={placeHolder} value={value} onChange={onChange} />
</FieldWrapper>
);
};
InputField.defaultProps = {
id: `input-${(Math.random() * 10).toString()}`,
};