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