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

enhanced scroll buttons #1311

Closed
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
8 changes: 7 additions & 1 deletion src/components/chatbot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ const ChatbotScript = () => {
useEffect(() => {
window.embeddedChatbotConfig = {
chatbotId: "lb8tTNFhXryOebzVM1edo",
domain: "www.chatbase.co"
domain: "www.chatbase.co",
customStyles: {
position: 'fixed',
left: '20px',
bottom: '20px',
zIndex: '1000', // Ensures it stays on top of other elements
}
};

const script = document.createElement('script');
Expand Down
15 changes: 9 additions & 6 deletions src/css/BottomToTop.module.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
.scrollToTopButton {
position: fixed;
bottom: 80px;
right: 20px;
left: 20px; /* Position on the left bottom corner */
background-color: #007bff;
color: white;
border: none;
border-radius: 8px;
padding: 10px;
border-radius: 50%; /* Changed to 50% for a fully rounded button */
width: 50px; /* Set a width for the circular button */
height: 50px; /* Set a height for the circular button */
padding: 0; /* Removed padding to maintain the circle shape */
cursor: pointer;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
transition: opacity 0.3s;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Enhanced shadow for a more polished look */
transition: opacity 0.3s, transform 0.2s; /* Added transform for hover effect */
opacity: 0.8;
z-index: 1000;
}

.scrollToTopButton:hover {
background-color: #0056b3;
opacity: 1;
}
transform: scale(1.1); /* Slightly enlarge on hover for emphasis */
}
22 changes: 13 additions & 9 deletions src/css/TopToBottom.module.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
.scrollToBottomButton {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #28a745;
bottom: 10px;
left: 20px;
background-color: rgba(128, 128, 128, 0.6);
color: white;
border: none;
border-radius: 8px;
padding: 10px;
border-radius: 50%;
width: 50px;
height: 50px;
padding: 0;
font-size: 15px; /* Increase font size for a larger arrow */
cursor: pointer;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
transition: opacity 0.3s;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: opacity 0.3s, transform 0.2s;
opacity: 0.8;
z-index: 1000;
}

.scrollToBottomButton:hover {
background-color: #218838;
background-color: rgba(100, 100, 100, 0.7);
opacity: 1;
}
transform: scale(1.1);
}
9 changes: 9 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
::-webkit-scrollbar-thumb:hover {
background: var(--ifm-color-primary-dark);
}
/* Custom CSS for the chatbot */
#chatbot-container {
position: fixed;
left: 20px;
bottom: 20px;
z-index: 1000; /* Ensures it’s on top */
width: 300px; /* Adjust width as needed */
height: 500px; /* Adjust height as needed */
}

:root {
--ifm-color-primary: #3b82f6;
Expand Down
40 changes: 20 additions & 20 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ import ChatbotIframe from "../components/chatbot.jsx";
export default function Home() {
const { siteConfig } = useDocusaurusContext();

useEffect(() => {
// Create and append the Chatrace script
const chatraceScript = document.createElement("script");
chatraceScript.src = "https://chatrace.com/webchat/plugin.js?v=5";
chatraceScript.async = true;
chatraceScript.onload = () => {
// Initialize the chat widget after the script loads
if (window.ktt10) {
window.ktt10.setup({
id: "2Xk6i0bywhd02D",
accountId: "1322274",
color: "#006dff",
});
}
};
document.body.appendChild(chatraceScript);
// useEffect(() => {
// // Create and append the Chatrace script
// const chatraceScript = document.createElement("script");
// chatraceScript.src = "https://chatrace.com/webchat/plugin.js?v=5";
// chatraceScript.async = true;
// chatraceScript.onload = () => {
// // Initialize the chat widget after the script loads
// if (window.ktt10) {
// window.ktt10.setup({
// id: "2Xk6i0bywhd02D",
// accountId: "1322274",
// color: "#006dff",
// });
// }
// };
// document.body.appendChild(chatraceScript);

return () => {
document.body.removeChild(chatraceScript);
};
}, []);
// return () => {
// document.body.removeChild(chatraceScript);
// };
// }, []);

return (
<Layout
Expand Down
Loading