Tweaks for JWT auth

This commit is contained in:
Gregory Schier
2025-01-17 15:23:15 -08:00
parent 6ae0bc1ef6
commit 7a6ab60d30
11 changed files with 142 additions and 33 deletions

View File

@@ -6,21 +6,33 @@ export function Label({
className,
optional,
children,
visuallyHidden,
otherTags = [],
...props
}: HTMLAttributes<HTMLLabelElement> & { htmlFor: string; optional?: boolean }) {
}: HTMLAttributes<HTMLLabelElement> & {
htmlFor: string;
optional?: boolean;
otherTags?: string[];
visuallyHidden?: boolean;
}) {
const tags = optional ? ['optional', ...otherTags] : otherTags;
return (
<label
className={classNames(className, 'text-text-subtle whitespace-nowrap flex items-center gap-1')}
className={classNames(
className,
visuallyHidden && 'sr-only',
'flex-shrink-0',
'text-text-subtle whitespace-nowrap flex items-center gap-1',
)}
htmlFor={htmlFor}
{...props}
>
{children}
{optional ? (
<>
{' '}
<span className="text-xs text-text-subtlest">(optional)</span>
</>
) : null}
{tags.map((tag, i) => (
<span key={i} className="text-xs text-text-subtlest">
({tag})
</span>
))}
</label>
);
}