Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
No EOL
1.9 KiB
TypeScript
54 lines
No EOL
1.9 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { cn } from "@/lib/utils"
|
|
|
|
export interface FormTextareaProps
|
|
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
label?: string
|
|
error?: string
|
|
helperText?: string
|
|
}
|
|
|
|
const FormTextarea = React.forwardRef<HTMLTextAreaElement, FormTextareaProps>(
|
|
({ className, label, error, helperText, id, ...props }, ref) => {
|
|
const textareaId = id || `textarea-${Math.random().toString(36).substr(2, 9)}`
|
|
|
|
return (
|
|
<div className="space-y-2">
|
|
{label && (
|
|
<label
|
|
htmlFor={textareaId}
|
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
>
|
|
{label}
|
|
</label>
|
|
)}
|
|
<div className="relative">
|
|
<textarea
|
|
id={textareaId}
|
|
data-slot="textarea"
|
|
className={cn(
|
|
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-[100px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow,border-color] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
error
|
|
? "border-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40"
|
|
: "",
|
|
className,
|
|
)}
|
|
ref={ref}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
{error && (
|
|
<p className="text-sm text-destructive">{error}</p>
|
|
)}
|
|
{helperText && !error && (
|
|
<p className="text-sm text-muted-foreground">{helperText}</p>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
)
|
|
FormTextarea.displayName = "FormTextarea"
|
|
|
|
export { FormTextarea } |