From f115648d412f17051cfaf945d80b5ebea416b00d Mon Sep 17 00:00:00 2001 From: baegofda Date: Mon, 4 Dec 2023 22:14:56 +0900 Subject: [PATCH] =?UTF-8?q?(#0)=20=20InputSelect=20value=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Input/InputSelect/InputSelect.stories.tsx | 1 + src/core/components/Input/InputSelect/index.tsx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/components/Input/InputSelect/InputSelect.stories.tsx b/src/core/components/Input/InputSelect/InputSelect.stories.tsx index 57472f9..e1e2876 100644 --- a/src/core/components/Input/InputSelect/InputSelect.stories.tsx +++ b/src/core/components/Input/InputSelect/InputSelect.stories.tsx @@ -39,6 +39,7 @@ export const Default = (props: InputSelectProps) => { label = {props.label ?? "레이블"} placeholder = {props.placeholder ?? "메뉴 선택"} options = {options} + value = {currentValue} onChange = {onChangeHandler} /> ); diff --git a/src/core/components/Input/InputSelect/index.tsx b/src/core/components/Input/InputSelect/index.tsx index f6043c6..4227f2d 100644 --- a/src/core/components/Input/InputSelect/index.tsx +++ b/src/core/components/Input/InputSelect/index.tsx @@ -8,6 +8,7 @@ const InputSelect = forwardRef(( { options, placeholder, + value, ...props }: InputSelectProps, ref: React.Ref, @@ -17,7 +18,7 @@ const InputSelect = forwardRef(( const { label, rootClassName, className, onChange, required, ...rest } = props; const onChangeHandler = (e: React.ChangeEvent) => { - !isSelectedValue &&setIsSelectedValue(true); + !isSelectedValue && setIsSelectedValue(true); onChange?.(e); }; @@ -32,7 +33,7 @@ const InputSelect = forwardRef(( ref = {ref} className = {clsx( "text-subhead-02-regular outline-none cursor-pointer", - !isSelectedValue ? "text-gray-05" : "text-gray-08", + !value && !isSelectedValue ? "text-gray-05" : "text-gray-08", className, )} onChange = {onChangeHandler}