Skip to content

Commit

Permalink
added back-to-top button
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsaanchanga committed Aug 8, 2023
1 parent 81c93e0 commit 9f08fe8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from "react";

import { Container, Row, Col } from "reactstrap";
import classes from "./footer.module.css";
import Link from "next/link";
import { FaArrowCircleUp } from "react-icons/fa";

const Footer = () => {
const date = new Date();
const year = date.getFullYear();

const handleBackToTopButtonClick = () =>
window.scrollTo({ top: 0, behavior: "smooth" });

return (
<footer>
<Container>
Expand All @@ -21,6 +23,9 @@ const Footer = () => {
</div>
</Col>
</Row>
<button title="Back To Top" onClick={handleBackToTopButtonClick}>
<FaArrowCircleUp className={classes.backToTop__button} />
</button>
</Container>
</footer>
);
Expand Down
8 changes: 8 additions & 0 deletions components/Footer/footer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
text-align: center;
}

.backToTop__button {
color: var(--site-theme-color);
font-size: 30px;
position: absolute;
bottom: 30px;
right: 30px;
}

@media only screen and (max-width: 768px) {
.footer__top {
display: none;
Expand Down
1 change: 1 addition & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ footer {
padding-bottom: 10px;
padding-top: 20px;
border-top: 1px solid #171f38;
position: relative;
}

.primary__btn {
Expand Down

0 comments on commit 9f08fe8

Please sign in to comment.