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

Animations #24

Merged
merged 4 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add navlink animations
  • Loading branch information
mdyeates committed Aug 17, 2023
commit 550f792424ddf39e4f25c16eb04c82d729f0aa2d
39 changes: 30 additions & 9 deletions src/components/NavLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NavLink } from "react-router-dom";

import openMenu from "../images/open.svg";
import closeMenu from "../images/close.svg";
import { motion } from "framer-motion";

const NavLinks = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
Expand All @@ -16,18 +17,38 @@ const NavLinks = () => {
)}
</button>
<nav className={`links ${isMenuOpen ? "open" : "closed"}`}>
<NavLink to="/" onClick={() => setIsMenuOpen(false)}>
Home
</NavLink>
<motion.div
initial={{ x: -100, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
transition={{ duration: 1.3, ease: "easeInOut" }}
>
<NavLink to="/" onClick={() => setIsMenuOpen(false)}>
Home
</NavLink>
</motion.div>

{/* <NavLink to="/about" onClick={() => setIsMenuOpen(false)}>
About
</NavLink> */}
<NavLink to="/portfolio" onClick={() => setIsMenuOpen(false)}>
Portfolio
</NavLink>
<NavLink to="/contact" onClick={() => setIsMenuOpen(false)}>
Contact
</NavLink>
<motion.div
initial={{ x: -100, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
transition={{ duration: 0.9, ease: "easeInOut" }}
>
<NavLink to="/portfolio" onClick={() => setIsMenuOpen(false)}>
Portfolio
</NavLink>
</motion.div>

<motion.div
initial={{ x: -100, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
transition={{ duration: 0.5, ease: "easeInOut" }}
>
<NavLink to="/contact" onClick={() => setIsMenuOpen(false)}>
Contact
</NavLink>
</motion.div>
</nav>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ footer .socialIcons::after {
margin-left: 3px;
}

.links a:not(:last-child) {
.links div:not(:last-child) {
margin-right: 20px;
}

Expand Down