Skip to content
Snippets Groups Projects
Unverified Commit ad63ca0f authored by Avanish Singh's avatar Avanish Singh Committed by GitHub
Browse files

Delete frontend-react/src/components/Input_area.js

parent 1960a630
No related branches found
No related tags found
No related merge requests found
import React, {useRef, useState} from 'react';
import '../styles/style.css';
const InputArea = (props) => {
const [value, setValue] = useState("")
const textareaRef = useRef(null);
const handleKeyDown = (event) => {
if (event.key === 'Enter') {
event.preventDefault();
return false;
}
};
// Function to handle sending messages
function HandleSend(){
if (value !== "") {
props.send_button(value, "right");
setValue("")
}
}
return (
<div className="header_bottom" id="input">
<textarea id="input_area" ref={textareaRef} onKeyDown={handleKeyDown} placeholder="say HEY to start" value={value} onChange={event => setValue(event.target.value)}></textarea>
<button className="send_button" type="submit" id="send" onClick={HandleSend}>Send</button>
</div>
);
};
document.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
document.getElementById('send').click();
}
});
export default InputArea;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment