requested changes

This commit is contained in:
Daniel Hougaard
2025-09-23 05:07:00 +04:00
parent 2fac3c19b1
commit b73d6fcbe8
4 changed files with 69 additions and 45 deletions
+3 -10
View File
@@ -1,9 +1,6 @@
import { ChangeEvent, forwardRef, InputHTMLAttributes, ReactNode } from "react";
import { cva, VariantProps } from "cva";
import { twMerge } from "tailwind-merge";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faWarning } from "@fortawesome/free-solid-svg-icons";
import { Tooltip } from "../Tooltip";
type Props = {
placeholder?: string;
@@ -15,7 +12,7 @@ type Props = {
isReadOnly?: boolean;
autoCapitalization?: boolean;
containerClassName?: string;
warningMessage?: string | ReactNode;
warning?: ReactNode;
};
const inputVariants = cva(
@@ -88,7 +85,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
size = "md",
isReadOnly,
autoCapitalization,
warningMessage,
warning,
...props
},
ref
@@ -125,11 +122,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
inputVariants({ className, isError, size, isRounded, variant })
)}
/>
{warningMessage && !rightIcon && (
<Tooltip className="w-full max-w-72" content={warningMessage}>
<FontAwesomeIcon icon={faWarning} className="absolute right-0 mr-3 text-yellow-500" />
</Tooltip>
)}
{Boolean(warning) && !rightIcon && warning}
{rightIcon && <span className="absolute right-0 mr-3">{rightIcon}</span>}
</div>
);