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