Deploy
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
||||||
|
error?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Input({ className, error, ...props }: InputProps) {
|
||||||
|
return (
|
||||||
|
<div className="w-full">
|
||||||
|
<input
|
||||||
|
className={cn(
|
||||||
|
"flex h-10 w-full rounded-md border border-border bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
|
error && "border-red-500 focus:border-red-500",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
aria-invalid={!!error}
|
||||||
|
aria-describedby={error ? `${props.id}-error` : undefined}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
{error && (
|
||||||
|
<p id={`${props.id}-error`} className="mt-1 text-xs text-red-500" role="alert">
|
||||||
|
{error}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user