Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,26 @@ const Chat = ({
placeholder = placeholderText;
}

const inputArea = (
<form
className="react-chatbot-kit-chat-input-form"
onSubmit={handleSubmit}
>
<input
className="react-chatbot-kit-chat-input"
placeholder={placeholder}
value={input}
onChange={(e) => setInputValue(e.target.value)}
/>
<button
className="react-chatbot-kit-chat-btn-send"
style={customButtonStyle}
>
<ChatIcon className="react-chatbot-kit-chat-btn-send-icon" />
</button>
</form>
);

return (
<div className="react-chatbot-kit-chat-container">
<div className="react-chatbot-kit-chat-inner-container">
Expand Down Expand Up @@ -299,23 +319,13 @@ const Chat = ({
</div>

<div className="react-chatbot-kit-chat-input-container">
<form
className="react-chatbot-kit-chat-input-form"
onSubmit={handleSubmit}
>
<input
className="react-chatbot-kit-chat-input"
placeholder={placeholder}
value={input}
onChange={(e) => setInputValue(e.target.value)}
/>
<button
className="react-chatbot-kit-chat-btn-send"
style={customButtonStyle}
>
<ChatIcon className="react-chatbot-kit-chat-btn-send-icon" />
</button>
</form>
<ConditionallyRender
condition={!!customComponents.inputMessage}
show={customComponents.inputMessage && customComponents.inputMessage({
input, setInputValue, handleSubmit, placeholder
})}
elseShow={inputArea}
/>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/IConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ICustomComponents {
botChatMessage?: (props?: any) => ReactElement;
userAvatar?: (props?: any) => ReactElement;
userChatMessage?: (props?: any) => ReactElement;
inputMessage?: (props?: any) => ReactElement;
}

export interface ICustomMessage {
Expand Down