Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing button was not there in chatbot #594

Merged
merged 4 commits into from
Jun 1, 2024
Merged
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
35 changes: 22 additions & 13 deletions frontend/src/ChatAssistant/ChatAssistant.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@
right: 0;
margin-right: 20px;
margin-bottom: 12px;
z-index: 999;
}
.chatbot-close-animation{
.chatbot-close-animation {
animation: animate-close ease-in 0.3s forwards;

}
.chatbot-animation{

.chatbot-animation {
animation: animate ease-in 0.3s forwards;
}
@keyframes animate {
from{
from {
height: 0px;
/* width: 250px; */
}to{
}
to {
height: 450px;
width: 350px;
}
}
@keyframes animate-close {
from{
from {
height: 450px;
width: 350px;
}to{
}
to {
height: 0px;
width: 0px;
}
Expand Down Expand Up @@ -65,11 +66,11 @@
height: 45px;
}

.Logo{
.Logo {
cursor: pointer;
height:50px;
width:50px;

height: 50px;
width: 50px;
}
.Logo {
height: 50px;
width: 50px;
Expand All @@ -89,7 +90,15 @@
width: 50px;
border-radius: 50px;
}

.close-button {
background-color: #55a0ea;
height: 45px;
width: 45px;
border-radius: 50px;
color: white;
font-size: 20px;
cursor: pointer;
}
@media only screen and (max-width: 425px) {
.chatbot {
margin-right: 5px;
Expand Down
81 changes: 52 additions & 29 deletions frontend/src/ChatAssistant/ChatAssistant.jsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,64 @@
import Chatbot from "react-chatbot-kit";
import 'react-chatbot-kit/build/main.css'
import config from '../ChatBot/config.jsx';
import MessageParser from '../ChatBot/MessageParser';
import ActionProvider from '../ChatBot/ActionProvider';
import "./ChatAssistant.css"
import React, { useState } from 'react';
import chatbotLogo from '../assets/chatbotLogo.jpeg'
import chatbotLogo1 from '../assets/logo1.png'
import "react-chatbot-kit/build/main.css";
import config from "../ChatBot/config.jsx";
import MessageParser from "../ChatBot/MessageParser";
import ActionProvider from "../ChatBot/ActionProvider";
import "./ChatAssistant.css";
import React, { useState } from "react";
import chatbotLogo from "../assets/chatbotLogo.jpeg";
import chatbotLogo1 from "../assets/logo1.png";

const ChatAssistant = () => {
const [isOpen, setIsOpen] = useState(false);

const toggleChatbot = () => {
setIsOpen(!isOpen);
};
return (
<div className="chatbot">
<img className="Logo" src={chatbotLogo} alt="Logo" onClick={toggleChatbot}
onMouseEnter={() => (document.querySelector(".Logo").src = chatbotLogo1)}
onMouseLeave={() => (document.querySelector(".Logo").src = chatbotLogo)}
/>
{isOpen &&

<img className="Logo" src={chatbotLogo} alt="Logo" onClick={toggleChatbot} />
<div className={`${isOpen?"chatbot-animation":"chatbot-close-animation"}`}>
const closeChatbot = () => {
setIsOpen(false);
};

{isOpen &&
<Chatbot
config={config}
messageParser={MessageParser}
actionProvider={ActionProvider}
/>

return (
<div className="chatbot">
<img
className="Logo"
src={chatbotLogo}
alt="Logo"
onClick={toggleChatbot}
onMouseEnter={() =>
(document.querySelector(".Logo").src = chatbotLogo1)
}
onMouseLeave={() => (document.querySelector(".Logo").src = chatbotLogo)}
/>
{isOpen && (
<div>
<img
className="Logo"
src={chatbotLogo}
alt="Logo"
onClick={toggleChatbot}
/>
<button className="close-button" onClick={closeChatbot}>
X
</button>
<div
className={`${
isOpen ? "chatbot-animation" : "chatbot-close-animation"
}`}
>
{isOpen && (
<Chatbot
config={config}
messageParser={MessageParser}
actionProvider={ActionProvider}
/>
)}
</div>
</div>
</div>
);
}

export default ChatAssistant;
)}
</div>
);
};

export default ChatAssistant;
Loading
Loading