Skip to content

Commit 295ed7a

Browse files
committed
small chevron tweaks
1 parent bda5f90 commit 295ed7a

File tree

2 files changed

+19
-49
lines changed

2 files changed

+19
-49
lines changed

src/components/home/sections/Hero.tsx

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const Hero: React.FC<HeroProps> = ({ id, backgroundImage }) => {
2424
const profilePictureContainer = useRef<HTMLDivElement>(null);
2525
const textContentContainer = useRef<HTMLDivElement>(null);
2626
const foregroundContainer = useRef<HTMLDivElement>(null);
27+
const scrollChevronContainer = useRef<HTMLDivElement>(null);
2728

2829
useGSAP(
2930
() => {
@@ -63,55 +64,20 @@ export const Hero: React.FC<HeroProps> = ({ id, backgroundImage }) => {
6364
}
6465
);
6566

67+
// Hide scroll chevron
68+
timeline.to(scrollChevronContainer.current, {
69+
duration: 1,
70+
opacity: 0,
71+
ease: "power1.out",
72+
});
73+
6674
// Fade up and out content
6775
timeline.to(foregroundContainer.current, {
6876
opacity: 0,
6977
y: "-20%",
7078
duration: 1,
7179
ease: "power1.out",
7280
});
73-
74-
// Initial animation
75-
// ScrollTrigger.create({
76-
// trigger: container.current,
77-
// start: "top",
78-
// end: "bottom 60%",
79-
// scrub: true,
80-
// animation: gsap.fromTo(
81-
// profilePictureContainer.current,
82-
// {
83-
// width: () => profilePictureContainer.current?.offsetWidth || 16,
84-
// height: () => profilePictureContainer.current?.offsetHeight || 16,
85-
// },
86-
// {
87-
// width: () =>
88-
// (profilePictureContainer.current?.offsetWidth || 8) / 2,
89-
// height: () => profilePictureContainer.current?.offsetHeight || 16,
90-
// duration: 0.5,
91-
// ease: "power1.out",
92-
// }
93-
// ),
94-
// });
95-
96-
// Move text content up and fade out
97-
// ScrollTrigger.create({
98-
// trigger: container.current,
99-
// start: "top",
100-
// end: "bottom 60%",
101-
// scrub: true,
102-
// animation: gsap.fromTo(
103-
// textContentContainer.current,
104-
// {
105-
// opacity: 1,
106-
// },
107-
// {
108-
// opacity: 0,
109-
// y: "-20%",
110-
// duration: 1,
111-
// ease: "power1.out",
112-
// }
113-
// ),
114-
// });
11581
},
11682
{
11783
scope: container,
@@ -123,7 +89,7 @@ export const Hero: React.FC<HeroProps> = ({ id, backgroundImage }) => {
12389
<section
12490
ref={container}
12591
id={id}
126-
className="relative h-screen flex justify-center items-center overflow-hidden bg-white-100 dark:bg-slate-600"
92+
className="relative h-screen flex flex-col justify-center items-center overflow-hidden bg-white-100 dark:bg-slate-600"
12793
>
12894
{/* Background for Parallax Effect */}
12995
<div
@@ -172,12 +138,15 @@ export const Hero: React.FC<HeroProps> = ({ id, backgroundImage }) => {
172138
{new Date().getFullYear() - 2018} years and counting.
173139
</span>
174140
</p>
175-
<div className="animated-content text-center mt-6 animate-bounce">
176-
<FontAwesomeIcon icon={faChevronDown} className="fa-2x" />
177-
</div>
178141
</div>
179142
</div>
180143
</div>
144+
145+
<div ref={scrollChevronContainer} className="relative z-10">
146+
<div className="text-center mt-6 animate-bounce">
147+
<FontAwesomeIcon icon={faChevronDown} className="fa-2x" />
148+
</div>
149+
</div>
181150
</section>
182151
);
183152
};

src/components/shared/Navbar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ const Navbar: React.FC = () => {
1717
const [activeItem, setActiveItem] = useState<NavItem>();
1818
const [isMobileMenuOpen, setMobileMenuOpen] = useState(false);
1919
const pathname = usePathname();
20-
const navItems =
21-
navPages.find((navPage) => navPage.path == pathname)?.items ?? [];
20+
const navItems = React.useMemo(() => {
21+
return navPages.find((navPage) => navPage.path == pathname)?.items ?? [];
22+
}, [pathname]);
2223

2324
useEffect(() => {
2425
const handleScroll = () => {
@@ -61,7 +62,7 @@ const Navbar: React.FC = () => {
6162
return () => {
6263
sections.forEach((section) => observer.unobserve(section));
6364
};
64-
}, []);
65+
}, [navItems]);
6566

6667
const handleNavigationClick = (
6768
e: React.MouseEvent<HTMLAnchorElement>,

0 commit comments

Comments
 (0)