diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx index f57b889f..55c0509e 100644 --- a/src/components/ui/input/index.tsx +++ b/src/components/ui/input/index.tsx @@ -2,21 +2,40 @@ import { forwardRef, type ReactNode } from 'react'; import { cn } from '@/lib/utils'; -interface InputProps extends React.InputHTMLAttributes { - iconButton?: ReactNode; +// 둘 다 없음 +interface NoneIcons { + frontIcon?: undefined; + iconButton?: undefined; } +// frontIcon만 +interface OnlyFront { + frontIcon: ReactNode; + iconButton?: undefined; +} + +// backIcon만 +interface OnlyBack { + frontIcon?: undefined; + iconButton: ReactNode; +} + +type InputProps = (NoneIcons | OnlyFront | OnlyBack) & React.InputHTMLAttributes; + export const Input = forwardRef( - ({ className, type, iconButton, ...props }, ref) => { + ({ className, type, iconButton, frontIcon, ...props }, ref) => { const hasIcon = !!iconButton; + const hasFrontIcon = !!frontIcon; return (
+ {frontIcon}