forked from React-Group/interstellar_ai
		
	Merge pull request 'main' (#25) from YasinOnm08/interstellar_ai:main into main
Reviewed-on: https://interstellardevelopment.org/code/code/React-Group/interstellar_ai/pulls/25
This commit is contained in:
		
						commit
						042304133c
					
				
					 1 changed files with 12 additions and 3 deletions
				
			
		|  | @ -14,19 +14,28 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>( | |||
|       setInputValue(e.target.value); | ||||
|     }; | ||||
| 
 | ||||
|     const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { | ||||
|       if (event.key === 'Enter') { | ||||
|         onSendClick(inputValue); // Call the function passed via props
 | ||||
|         setInputValue(''); // Optionally clear input after submission
 | ||||
|         event.preventDefault(); // Prevent default action (e.g., form submission)
 | ||||
|       } | ||||
|     }; | ||||
| 
 | ||||
|     return ( | ||||
|       <div className="input" id="inputForm"> | ||||
|       <div className="input" id="inputForm" ref={ref}> | ||||
|         <input | ||||
|           type="text" | ||||
|           name="user_message" | ||||
|           placeholder="Type your message here..." | ||||
|           value={inputValue} | ||||
|           onChange={handleInputChange} | ||||
|           onKeyDown={handleKeyDown} | ||||
|         /> | ||||
|         <button type="submit" onClick={() => onSendClick(inputValue)}> | ||||
|         <button type="button" onClick={() => onSendClick(inputValue)}> | ||||
|           <img src="/img/send.svg" alt="send" /> | ||||
|         </button> | ||||
|         <button type="submit" onClick={onMicClick}> | ||||
|         <button type="button" onClick={onMicClick}> | ||||
|           <img src="/img/microphone.svg" alt="microphone" /> | ||||
|         </button> | ||||
|       </div> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue