Compare commits
No commits in common. "042304133c12f016b769ae9ee313ba9986a0551a" and "267e06a4cb56e8b5be3682af0767df23c23c5e19" have entirely different histories.
042304133c
...
267e06a4cb
1 changed files with 3 additions and 12 deletions
|
@ -14,28 +14,19 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
|
||||||
setInputValue(e.target.value);
|
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 (
|
return (
|
||||||
<div className="input" id="inputForm" ref={ref}>
|
<div className="input" id="inputForm">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="user_message"
|
name="user_message"
|
||||||
placeholder="Type your message here..."
|
placeholder="Type your message here..."
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
onKeyDown={handleKeyDown}
|
|
||||||
/>
|
/>
|
||||||
<button type="button" onClick={() => onSendClick(inputValue)}>
|
<button type="submit" onClick={() => onSendClick(inputValue)}>
|
||||||
<img src="/img/send.svg" alt="send" />
|
<img src="/img/send.svg" alt="send" />
|
||||||
</button>
|
</button>
|
||||||
<button type="button" onClick={onMicClick}>
|
<button type="submit" onClick={onMicClick}>
|
||||||
<img src="/img/microphone.svg" alt="microphone" />
|
<img src="/img/microphone.svg" alt="microphone" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue