populate header fields

This commit is contained in:
2026-06-02 22:33:27 +02:00
parent 00267b05ba
commit 5ed83a20d8
6 changed files with 60 additions and 24 deletions
+9 -1
View File
@@ -1,9 +1,15 @@
import { useChessGame } from "#/hooks/useChessGame.ts";
import type { IHeader } from "#/interfaces.ts";
export interface IFormField {
fieldName: string;
type: string;
headers: IHeader;
}
const FormField = ({ fieldName, type }: IFormField) => {
const FormField = ({ fieldName, type, headers }: IFormField) => {
const { updateHeaders } = useChessGame();
return (
<div className="flex flex-col gap-2">
<label htmlFor={fieldName} className="text-sm capitalize">
@@ -14,6 +20,8 @@ const FormField = ({ fieldName, type }: IFormField) => {
type={type}
id={fieldName}
name={fieldName}
value={headers[fieldName]}
onChange={(e) => updateHeaders(e, fieldName)}
/>
</div>
);