@@ -5,25 +5,31 @@ import classNames from "classnames";
55import styles from "@/components/ui/Input/Input.module.scss" ;
66import type { InputProps } from "@/components/ui/Input/Input.types" ;
77
8- const Input = forwardRef < HTMLInputElement , InputProps > ( ( { className, type, ...props } , ref ) => {
9- const [ isFocused , setIsFocused ] = useState ( false ) ;
8+ const Input = forwardRef < HTMLInputElement , InputProps > (
9+ ( { className, type, variant = "primary" , ...props } , ref ) => {
10+ const [ isFocused , setIsFocused ] = useState ( false ) ;
1011
11- const handleFocus = ( ) => setIsFocused ( true ) ;
12- const handleBlur = ( ) => setIsFocused ( false ) ;
12+ const handleFocus = ( ) => setIsFocused ( true ) ;
13+ const handleBlur = ( ) => setIsFocused ( false ) ;
1314
14- return (
15- < div className = { classNames ( styles . InputWrapper , { [ styles . Focused ] : isFocused } ) } >
16- < input
17- type = { type }
18- ref = { ref }
19- className = { classNames ( styles . Input , className ) }
20- onFocus = { handleFocus }
21- onBlur = { handleBlur }
22- { ...props }
23- />
24- < button > 수정</ button >
25- </ div >
26- ) ;
27- } ) ;
15+ return (
16+ < div
17+ className = { classNames ( styles . InputWrapper , styles [ `style-${ variant } ` ] , {
18+ [ styles . Focused ] : isFocused ,
19+ } ) }
20+ >
21+ < input
22+ type = { type }
23+ ref = { ref }
24+ className = { classNames ( styles . Input , className ) }
25+ onFocus = { handleFocus }
26+ onBlur = { handleBlur }
27+ { ...props }
28+ />
29+ { variant === "primary" && < button > 수정</ button > }
30+ </ div >
31+ ) ;
32+ } ,
33+ ) ;
2834
2935export default Input ;
0 commit comments