feat: scaffold complete danable frontend architecture with all pages, layouts, stores, and 3 annotator modes
This commit is contained in:
commit
78848dd7d1
173 changed files with 18649 additions and 0 deletions
46
src/components/ui/Textarea.tsx
Normal file
46
src/components/ui/Textarea.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import React from 'react'
|
||||
import clsx from 'clsx'
|
||||
|
||||
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||
label?: string
|
||||
error?: string
|
||||
helperText?: string
|
||||
}
|
||||
|
||||
export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ label, error, helperText, className, id, rows = 3, ...props }, ref) => {
|
||||
const textareaId =
|
||||
id || (label ? `textarea-${label.replace(/\s+/g, '-').toLowerCase()}` : undefined)
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
{label && (
|
||||
<label
|
||||
htmlFor={textareaId}
|
||||
className="block text-sm font-medium text-slate-700 mb-1.5"
|
||||
>
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
<textarea
|
||||
ref={ref}
|
||||
id={textareaId}
|
||||
rows={rows}
|
||||
className={clsx(
|
||||
'w-full rounded-xl border bg-white px-3.5 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 transition-colors focus:outline-none focus:ring-2',
|
||||
error
|
||||
? 'border-red-400 focus:border-red-500 focus:ring-red-500/20'
|
||||
: 'border-slate-200 focus:border-[#C95C3C] focus:ring-[#C95C3C]/20',
|
||||
props.disabled && 'bg-slate-50 text-slate-500 cursor-not-allowed',
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
{error && <p className="mt-1.5 text-xs text-red-600">{error}</p>}
|
||||
{!error && helperText && <p className="mt-1.5 text-xs text-slate-500">{helperText}</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Textarea.displayName = 'Textarea'
|
||||
Loading…
Add table
Add a link
Reference in a new issue