32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { cn } from "@/app/lib/cn";
|
|
import { SearchNormal } from "iconsax-reactjs";
|
|
import { FC } from "react";
|
|
|
|
export type InputVariant = "primary" | "search";
|
|
|
|
type Props = {
|
|
variant?: InputVariant;
|
|
className?: string;
|
|
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
|
|
const Input: FC<Props> = (props) => {
|
|
const { variant = "primary", className, ...rest } = props;
|
|
|
|
return (
|
|
<div className="relative w-full" dir="rtl">
|
|
{variant === "search" && <SearchNormal aria-hidden="true" className="pointer-events-none absolute top-1/2 right-5 -translate-y-1/2 text-primary" color="currentColor" size={24} />}
|
|
<input
|
|
type={variant === "search" ? "search" : "text"}
|
|
className={cn(
|
|
"h-12 w-full rounded-2xl border border-secondary bg-white px-5 text-right text-sm text-[#3A4147] placeholder:text-[#D7E0E8] transition-colors focus:border-primary",
|
|
variant === "search" && "pr-13",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Input;
|