30 lines
836 B
TypeScript
30 lines
836 B
TypeScript
import { forwardRef } from "react"
|
|
|
|
interface InputTextProps
|
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
label?: string
|
|
error?: string | undefined
|
|
}
|
|
|
|
export const InputTextR = forwardRef<HTMLInputElement, InputTextProps>(
|
|
({ label, error, ...props }, ref) => {
|
|
return (
|
|
<div className="mb-1 bg-green-00">
|
|
{label && (
|
|
<label className="text-sm font-normal text-gray-600 font-mono ps-1">
|
|
{label}
|
|
</label>
|
|
)}
|
|
|
|
<input ref={ref}
|
|
className={`w-full ps-2 h-7 border rounded ${error ? "border-red-500" : "border-gray-300"} focus:outline-none focus:ring-1 focus:ring-blue-800`}
|
|
{...props}
|
|
/>
|
|
|
|
{false && error && <p className="text-red-500 text-sm mt-1">{error}</p>}
|
|
</div>
|
|
)
|
|
}
|
|
)
|
|
|
|
InputTextR.displayName = "InputR" |