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

refactor: optimize footer code #1631 #1632

Merged
merged 2 commits into from
Sep 26, 2023
Merged
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
11 changes: 5 additions & 6 deletions src/components/BackToTop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const BackToTopButton = () => {
}
useEffect(() => {
const toggleVisiblity = () => {
window.pageYOffset > 250 ? setBtnVisiblity(true) : setBtnVisiblity(false)
window.scrollY > 250 ? setBtnVisiblity(true) : setBtnVisiblity(false)
}
window.addEventListener('scroll', toggleVisiblity)
return () => {
Expand All @@ -21,12 +21,11 @@ const BackToTopButton = () => {
}, [])

return (
<Link onClick={handleScroll} to="Top" smooth duration={500} className={`top ${darkMode ? 'dark-mode' : ''}`}href='#' aria-label='Go to top of website'>
<div
className={` ${
!btnVisiblity ? 'transition-before' : 'transition-after'
<Link onClick={handleScroll} to="Top" smooth duration={500} className={`top ${darkMode ? 'dark-mode' : ''}`} href='#' aria-label='Go to top of website'>
<div
className={` ${!btnVisiblity ? 'transition-before' : 'transition-after'
} backToTopButton`}
>
>
<div className={`button ${darkMode ? 'dark-mode' : ''}`}>
<i className="ri-arrow-up-s-line"></i>
</div>
Expand Down
107 changes: 48 additions & 59 deletions src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,87 +1,76 @@
import freehitlogo from '../assets/footer-logo.webp'
import { NavLink } from "react-router-dom"
import "../styles/Footer.css"

const Footer = () => {
// gettin year dynamically
// getting year dynamically
const date = new Date();
const year = date.getFullYear();

// to add social links
const socialLinks = [
{
label: 'Twitter',
iconClass: 'socials_twitter ri-twitter-fill',
url: 'https://twitter.com/_Jason_Dsouza',
},
{
label: 'GitHub',
iconClass: 'socials_github ri-github-fill',
url: 'https://github.com/JasonDsouza212',
},
{
label: 'LinkedIn',
iconClass: 'socials_linkedin ri-linkedin-fill',
url: 'https://www.linkedin.com/in/jason-dsouza-130b421ba/',
},
{
label: 'Email',
iconClass: 'socials_mail ri-mail-fill',
url: 'mailto:[email protected]',
},
];
return (
<footer>
<div className="footer-content">
<h3>
<a className="" href="/about">
<img className="free-logo-footer" src={freehitlogo} alt="logo" />
</a>
<NavLink to="/about">
<img className="free-logo-footer" src={freehitlogo} alt="logo" />
</NavLink>
</h3>
<p>
Find the tools you need without breaking the bank
</p>
<p>
<b>Contact Us</b>
</p>
<p>Find the tools you need without breaking the bank</p>
<p>Contact Us</p>
<ul className="socials">
<li>
<a
aria-label="Follow me on Twitter"
title="Twitter (External Link)"
rel="noopener noreferrer"
target="_blank"
href="https://twitter.com/_Jason_Dsouza"
>
<i className="socials_twitter ri-twitter-fill"></i>
</a>
</li>
<li>
<a
aria-label="Follow me on Github"
title="Github (External Link)"
rel="noopener noreferrer"
target="_blank"
href="https://github.com/JasonDsouza212"
>
<i className="socials_github ri-github-fill"></i>
</a>
</li>
<li>
<a
aria-label="Follow me on Linkedin"
title="Linkedin (External Link)"
rel="noopener noreferrer"
target="_blank"
href="https://www.linkedin.com/in/jason-dsouza-130b421ba/"
>
<i className="socials_linkedin ri-linkedin-fill"></i>
</a>
</li>
<li>
<a
aria-label="Mail me on [email protected]"
title="Mail (External Link)"
rel="noopener noreferrer"
target="_blank"
href="mailto:[email protected]"
>
<i className="socials_mail ri-mail-fill"></i>
</a>
</li>
{socialLinks.map((link, index) => (
<li key={index}>
<a
aria-label={`Follow me on ${link.label}`}
rel="noopener noreferrer"
target="_blank"
href={link.url}
>
<i className={link.iconClass}></i>
</a>
</li>
))}
</ul>
</div>
<div className="footer-bottom">
<br />
<p>
<span className='uppercase'>
Copyright &copy; Free-Hit {year}
</span>
<span className="uppercase">Copyright &copy; Free-Hit {year}</span>
&nbsp;&nbsp; | &nbsp;&nbsp;
<span>
Maintained by &nbsp;
<a target="_blank" href="https://github.com/JasonDsouza212" className='uppercase'>
Maintained by&nbsp;
<a href="https://github.com/JasonDsouza212" className="uppercase">
<b>Jason Dsouza</b>
</a>
</span>
</p>
<br />
</div>
</footer>

)
}

Expand Down