init project

This commit is contained in:
root
2026-06-25 19:06:59 -04:00
parent c5dfee6efb
commit 5d017f533a
349 changed files with 31330 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
import { classNames } from '@/lib/components/classNames';
import type { ReactNode } from 'react';
import styles from './FormField.module.css';
interface FormFieldProps {
id: string;
label: string;
required?: boolean;
optionalLabel?: string;
supportingText?: string;
error?: string;
children: ReactNode;
className?: string;
}
export function FormField({
id,
label,
required = false,
optionalLabel,
supportingText,
error,
children,
className,
}: FormFieldProps) {
return (
<div className={classNames(styles.field, error && styles.invalid, className)}>
<label className={styles.label} htmlFor={id}>
<span>{label}</span>
{required ? (
<span aria-hidden="true" className={styles.required}>
*
</span>
) : null}
{!required && optionalLabel ? (
<span className={styles.optional}>{optionalLabel}</span>
) : null}
</label>
{children}
{supportingText ? (
<p id={`${id}-help`} className={styles.help}>
{supportingText}
</p>
) : null}
{error ? (
<p id={`${id}-error`} className={styles.error}>
<span aria-hidden="true">!</span> {error}
</p>
) : null}
</div>
);
}
export function Fieldset({
legend,
children,
className,
}: {
legend: string;
children: ReactNode;
className?: string;
}) {
return (
<fieldset className={classNames(styles.fieldset, className)}>
<legend className={styles.legend}>{legend}</legend>
{children}
</fieldset>
);
}