Compare commits

..

2 Commits

2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export function Chat({ dialog, typing, statusMessage, onSend }: ChatProps): Reac
/> />
{statusMessage && <div className={b('statusMessage')}>{statusMessage}</div>} {statusMessage && <div className={b('statusMessage')}>{statusMessage}</div>}
<Input <Input
typing={typing} disabled={typing}
onSend={onSend} onSend={onSend}
/> />
</div> </div>
+5 -5
View File
@@ -7,17 +7,17 @@ import styles from './Input.module.css';
const b = block(styles, 'Input'); const b = block(styles, 'Input');
interface InputProps { interface InputProps {
typing?: boolean; disabled?: boolean;
onSend?: (text: string) => void; onSend?: (text: string) => void;
} }
export function Input({ typing, onSend }: InputProps): ReactNode { export function Input({ disabled, onSend }: InputProps): ReactNode {
const [input, setInput] = useState(''); const [input, setInput] = useState('');
const handleSend = () => { const handleSend = () => {
const text = input.trim(); const text = input.trim();
if (!text || typing) { if (!text || disabled) {
return; return;
} }
@@ -41,12 +41,12 @@ export function Input({ typing, onSend }: InputProps): ReactNode {
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
placeholder="Type your message here..." placeholder="Type your message here..."
rows={1} rows={1}
disabled={typing} disabled={disabled}
/> />
<button <button
className={b('send')} className={b('send')}
onClick={handleSend} onClick={handleSend}
disabled={typing || !input.trim()} disabled={disabled || !input.trim()}
> >
<PaperPlaneIcon /> <PaperPlaneIcon />
</button> </button>