refactor(forklifts): more refactoring to improve during production
This commit is contained in:
28
frontend/src/lib/formStuff/components/TextArea.tsx
Normal file
28
frontend/src/lib/formStuff/components/TextArea.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Label } from "../../../components/ui/label";
|
||||
import { useFieldContext } from "..";
|
||||
import { FieldErrors } from "./FieldErrors";
|
||||
|
||||
type InputFieldProps = {
|
||||
label: string;
|
||||
placeHolder: string;
|
||||
required: boolean;
|
||||
};
|
||||
export const TextArea = ({ label, placeHolder, required }: InputFieldProps) => {
|
||||
const field = useFieldContext<any>();
|
||||
|
||||
return (
|
||||
<div className="grid gap-3 w-64">
|
||||
<Label htmlFor={field.name}>{label}</Label>
|
||||
<Textarea
|
||||
id={field.name}
|
||||
value={field.state.value}
|
||||
onChange={(e) => field.handleChange(e.target.value)}
|
||||
placeholder={placeHolder}
|
||||
onBlur={field.handleBlur}
|
||||
required={required}
|
||||
/>
|
||||
<FieldErrors meta={field.state.meta} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user