chore: update devbook.md to mark completion of layout, UI components, and homepage; update dev.db
This commit is contained in:
45
src/components/ui/Textarea.tsx
Normal file
45
src/components/ui/Textarea.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { forwardRef, TextareaHTMLAttributes } from 'react';
|
||||
|
||||
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||
label?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ className = '', label, error, id, ...props }, ref) => {
|
||||
const textareaId = id || props.name;
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
{label && (
|
||||
<label
|
||||
htmlFor={textareaId}
|
||||
className="mb-2 block text-sm font-medium text-foreground"
|
||||
>
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
<textarea
|
||||
ref={ref}
|
||||
id={textareaId}
|
||||
className={`
|
||||
w-full rounded-lg border bg-input px-4 py-2.5 text-foreground
|
||||
placeholder:text-muted-foreground
|
||||
focus:outline-none focus:ring-2 focus:ring-primary/20
|
||||
disabled:cursor-not-allowed disabled:opacity-50
|
||||
resize-none
|
||||
${error ? 'border-destructive focus:border-destructive' : 'border-input-border focus:border-primary'}
|
||||
${className}
|
||||
`}
|
||||
{...props}
|
||||
/>
|
||||
{error && (
|
||||
<p className="mt-1.5 text-sm text-destructive">{error}</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Textarea.displayName = 'Textarea';
|
||||
|
||||
Reference in New Issue
Block a user