Files
GenExam-IA/frontend/src/components/ui/Field.jsx
T
Mireya Cueto Garrido 946f16a633 Add React frontend and Sinbad2IA LLM integration.
Introduce a full Vite/React UI for exams, auth, materials, images, generation, and export.
Adapt backend for Sinbad2IA chat API, bcrypt passwords, CORS on port 5173, and schema migrations.
2026-06-01 13:27:41 +02:00

55 lines
1.2 KiB
React

export function Field({ label, hint, error, children, htmlFor }) {
return (
<div className="field">
{label && (
<label className="field-label" htmlFor={htmlFor}>
{label}
</label>
)}
{children}
{error ? (
<div className="field-error">{error}</div>
) : hint ? (
<div className="field-hint">{hint}</div>
) : null}
</div>
);
}
export function Input({ error, className = "", ...props }) {
return (
<input
className={`input ${error ? "has-error" : ""} ${className}`}
{...props}
/>
);
}
export function Textarea({ error, mono, className = "", ...props }) {
return (
<textarea
className={`textarea ${mono ? "textarea-mono" : ""} ${
error ? "has-error" : ""
} ${className}`}
{...props}
/>
);
}
export function Select({ className = "", children, ...props }) {
return (
<select className={`select ${className}`} {...props}>
{children}
</select>
);
}
export function Checkbox({ label, checked, onChange, ...props }) {
return (
<label className="checkbox">
<input type="checkbox" checked={checked} onChange={onChange} {...props} />
{label}
</label>
);
}