Files
filing-cabinet-web/src/components/AuthForm.jsx
T
Sven laptop c891f53197 First commit
2026-07-24 21:55:46 +02:00

30 lines
916 B
React

export function AuthForm({ title, fields, onSubmit, submitLabel, footer }) {
return (
<section className="auth-card">
<h1>{title}</h1>
<form onSubmit={onSubmit} className="form-grid">
{fields.map((field) => (
<label key={field.name}>
<span>{field.label}</span>
<input
type={field.type || "text"}
name={field.name}
value={field.value}
onChange={field.onChange}
placeholder={field.placeholder}
required={field.required}
minLength={field.minLength}
maxLength={field.maxLength}
pattern={field.pattern}
title={field.title}
autoComplete={field.autoComplete}
/>
</label>
))}
<button type="submit">{submitLabel}</button>
</form>
{footer}
</section>
);
}