import React, { useState, ForwardedRef } from 'react'; interface InputProps { message: string; onSendClick: (message: string) => void; onMicClick: () => void; } const InputFrontend = React.forwardRef( ({ message, onSendClick, onMicClick }, ref: ForwardedRef) => { const [inputValue, setInputValue] = useState(''); const handleInputChange = (e: React.ChangeEvent) => { setInputValue(e.target.value); }; const handleKeyDown = (event: React.KeyboardEvent) => { 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 (
); } ); export default InputFrontend;