File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
src/domains/recommend/components Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ function ChatSection() {
2626 selectedCocktailType ?: string ;
2727 } > ( { } ) ;
2828
29+ const isInputDisabled =
30+ selectedOptions . current . selectedCocktailType !== 'QA' && userCurrentStep < 3 ;
31+
2932 const handleSendMessage = async ( payload : stepPayload | { message : string ; userId : string } ) => {
3033 const tempTypingId = `typing-${ Date . now ( ) } ` ;
3134
@@ -165,7 +168,7 @@ function ChatSection() {
165168 onSelectedOption = { handleSelectedOption }
166169 getRecommendations = { getRecommendations }
167170 />
168- < MessageInput onSubmit = { handleSubmitText } />
171+ < MessageInput onSubmit = { handleSubmitText } disabled = { isInputDisabled } />
169172 </ section >
170173 ) ;
171174}
Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ import { useRef, useState } from 'react';
77
88interface Props {
99 onSubmit : ( message : string ) => void ;
10+ disabled : boolean ;
1011}
1112
12- function MessageInput ( { onSubmit } : Props ) {
13+ function MessageInput ( { onSubmit, disabled } : Props ) {
1314 const [ value , setValue ] = useState ( '' ) ;
1415 const textareaRef = useRef < HTMLTextAreaElement > ( null ) ;
1516
@@ -35,8 +36,14 @@ function MessageInput({ onSubmit }: Props) {
3536 id = "chatInput"
3637 name = "chatInput"
3738 onInput = { ( e ) => resizeTextarea ( e . currentTarget ) }
38- placeholder = "칵테일 추천 질문을 입력해주세요."
39- className = "w-[calc(100%-3rem)] md:w-[calc(100%-3.75rem)] px-4 py-2 md:py-3.5 rounded-lg h-[40px] md:h-[52px] max-h-[160px] md:max-h-[280px] bg-white text-primary placeholder:text-gray-dark resize-none outline-none"
39+ placeholder = { disabled ? '옵션을 선택해주세요.' : '칵테일 추천 질문을 입력해주세요.' }
40+ disabled = { disabled }
41+ className = { `
42+ w-[calc(100%-3rem)] md:w-[calc(100%-3.75rem)] px-4 py-2 md:py-3.5
43+ rounded-lg h-[40px] md:h-[52px] max-h-[160px] md:max-h-[280px]
44+ bg-white text-primary placeholder:text-gray-dark resize-none outline-none
45+ disabled:bg-gray disabled:text-gray-dark disabled:cursor-not-allowed
46+ ` }
4047 />
4148 < button
4249 type = "button"
You can’t perform that action at this time.
0 commit comments