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>
  );
}
