Skip to content

Commit

Permalink
Merge pull request #348 from sakshii00/for-issue-339
Browse files Browse the repository at this point in the history
Added Scroll to top in about and contact us
  • Loading branch information
Sushilverma002 authored Jun 21, 2024
2 parents 175cee2 + 3b7c489 commit 8b7dad9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import whatsapp_icon from "../Assets/whatsapp_icon.png";
import { Link, useLocation } from "react-router-dom";
import { ShopContext } from "../../Context/ShopContext";

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

const Footer = () => {
const { theme } = useContext(ShopContext);
const location = useLocation();
Expand All @@ -31,13 +35,13 @@ const Footer = () => {
<li>Offices</li>
<li>
{" "}
<Link className={`link_${theme}`} to="/about">
<Link className={`link_${theme}`} to="/about " onClick={scrollToTop}>
About
</Link>
</li>
<li>
{" "}
<Link className={`link_${theme}`} to="/contact">
<Link className={`link_${theme}`} to="/contact" onClick={scrollToTop}>
Contact Us
</Link>
</li>
Expand Down

0 comments on commit 8b7dad9

Please sign in to comment.