3,200+ hardcoded color values replaced with CSS variable-backed Tailwind classes (bg-card, text-foreground, border-border, etc.). Enables light mode via CSS variable swap. Only syntax highlighting colors and intentional one-offs remain hardcoded (~15 values). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { cn } from '@/lib/utils'
|
|
|
|
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
error?: string
|
|
}
|
|
|
|
export function Textarea({ className, error, id, ...props }: TextareaProps) {
|
|
return (
|
|
<div>
|
|
<textarea
|
|
id={id}
|
|
className={cn(
|
|
'flex w-full rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground',
|
|
'placeholder:text-muted-foreground',
|
|
'focus:border-primary/30 focus:outline-hidden focus:ring-1 focus:ring-primary/20',
|
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
error && 'border-red-400/50 focus:border-red-400 focus:ring-red-400/20',
|
|
className
|
|
)}
|
|
aria-invalid={error ? true : undefined}
|
|
aria-describedby={error && id ? `${id}-error` : undefined}
|
|
{...props}
|
|
/>
|
|
{error && (
|
|
<p
|
|
id={id ? `${id}-error` : undefined}
|
|
className="mt-1.5 text-xs text-red-400"
|
|
role="alert"
|
|
>
|
|
{error}
|
|
</p>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|