-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from srini047/28-all-chatbot-integration
Add: Chat support and fix react-scroll position
- Loading branch information
Showing
6 changed files
with
140 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.scroll-to-top { | ||
position: fixed; | ||
left: 20px; | ||
bottom: 20px; | ||
z-index: 1000; | ||
background-color: #fff; | ||
width: 40px; | ||
height: 40px; | ||
border-radius: 50%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
cursor: pointer; | ||
opacity: 0; | ||
transition: opacity 0.3s ease; | ||
} | ||
|
||
.scroll-to-top:hover { | ||
background-color: #fff; | ||
} | ||
|
||
.scroll-to-top-icon { | ||
color: #555; | ||
font-size: 24px; | ||
} | ||
|
||
.scroll-to-top.visible { | ||
opacity: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
import React from 'react' | ||
import ScrollToTop from "react-scroll-to-top" | ||
|
||
const ScrollTop = () => { | ||
return ( | ||
<div> | ||
<ScrollToTop smooth /> | ||
</div> | ||
) | ||
import React from 'react'; | ||
import { FaArrowAltCircleUp } from 'react-icons/fa'; | ||
import { animateScroll as scroll } from 'react-scroll'; | ||
import './ScrollTop.css'; | ||
|
||
class ScrollToTopButton extends React.Component { | ||
state = { | ||
isScrollVisible: false | ||
}; | ||
|
||
componentDidMount() { | ||
window.addEventListener('scroll', this.handleScroll); | ||
} | ||
|
||
componentWillUnmount() { | ||
window.removeEventListener('scroll', this.handleScroll); | ||
} | ||
|
||
handleScroll = () => { | ||
const { isScrollVisible } = this.state; | ||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; | ||
|
||
if (!isScrollVisible && scrollTop > 0) { | ||
this.setState({ isScrollVisible: true }); | ||
} else if (isScrollVisible && scrollTop === 0) { | ||
this.setState({ isScrollVisible: false }); | ||
} | ||
}; | ||
|
||
scrollToTop = () => { | ||
scroll.scrollToTop(); | ||
}; | ||
|
||
render() { | ||
const { isScrollVisible } = this.state; | ||
|
||
return ( | ||
<div className={`scroll-to-top ${isScrollVisible ? 'visible' : ''}`} onClick={this.scrollToTop}> | ||
<FaArrowAltCircleUp className="scroll-to-top-icon" /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ScrollTop | ||
export default ScrollToTopButton; |
43a420e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
portfolio – ./
sriniketh.vercel.app
portfolio-git-master-srini047.vercel.app
portfolio-srini047.vercel.app
sriniketh.design