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

Fixed footer logo link #342

Merged
merged 2 commits into from
Jun 21, 2024
Merged
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
16 changes: 13 additions & 3 deletions src/Components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ import footer_logo from "../Assets/logo_big.png";
import instagram_icon from "../Assets/instagram_icon.png";
import pintester_icon from "../Assets/pintester_icon.png";
import whatsapp_icon from "../Assets/whatsapp_icon.png";
import { Link } from "react-router-dom";
import { Link, useLocation } from "react-router-dom";
import { ShopContext } from "../../Context/ShopContext";

const Footer = () => {
const { theme } = useContext(ShopContext);
const location = useLocation();

const handleLogoClick = () => {
if (location.pathname === "/") {
window.scrollTo({ top: 0, behavior: "smooth" });
}
};

return (
<div className="footer">
<div className="footer-logo">
<img src={footer_logo} alt="" />
<p className={`footer_${theme}`}>ShopNex</p>
<Link className="nav-logo-link" to="/" onClick={handleLogoClick}>
<img src={footer_logo} alt="ShopNex Logo" />
<p className={`footer_${theme}`}>ShopNex</p>
</Link>
</div>
<ul className={"footer-links_" + theme}>
<li>Company</li>
Expand Down
Loading