diff --git a/src/App.tsx b/src/App.tsx index 2aa95c7..77f78cf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import { BrowserRouter, Routes, Route } from 'react-router-dom'; import { LanguageProvider } from './i18n'; -import { Navbar, Footer, FancyCursor } from './components/layout'; +import { Navbar, Footer, FancyCursor, ScrollToTop } from './components/layout'; import { Home, About, Contact } from './pages'; import './styles/global.css'; @@ -8,6 +8,7 @@ export function App() { return ( + diff --git a/src/components/layout/FancyCursor.test.tsx b/src/components/layout/FancyCursor.test.tsx index da5d2d3..d7971d5 100644 --- a/src/components/layout/FancyCursor.test.tsx +++ b/src/components/layout/FancyCursor.test.tsx @@ -2,7 +2,6 @@ import { render, fireEvent, act } from '@testing-library/react'; import { FancyCursor } from './FancyCursor'; import { describe, it, expect, vi, beforeAll, afterAll, beforeEach } from 'vitest'; -import React from 'react'; describe('FancyCursor', () => { beforeAll(() => { diff --git a/src/components/layout/Navbar.test.tsx b/src/components/layout/Navbar.test.tsx index 83b0d65..ba028bf 100644 --- a/src/components/layout/Navbar.test.tsx +++ b/src/components/layout/Navbar.test.tsx @@ -14,7 +14,7 @@ describe('Navbar Performance', () => { scrollYGetterSpy = vi.fn(() => 0); Object.defineProperty(window, 'scrollY', { configurable: true, - get: scrollYGetterSpy, + get: scrollYGetterSpy as any, }); vi.useFakeTimers(); }); diff --git a/src/components/layout/ScrollToTop.tsx b/src/components/layout/ScrollToTop.tsx new file mode 100644 index 0000000..3e28147 --- /dev/null +++ b/src/components/layout/ScrollToTop.tsx @@ -0,0 +1,16 @@ +import { useLayoutEffect } from 'react'; +import { useLocation } from 'react-router-dom'; + +export function ScrollToTop() { + const { pathname } = useLocation(); + + useLayoutEffect(() => { + window.scrollTo({ + top: 0, + left: 0, + behavior: 'instant' + }); + }, [pathname]); + + return null; +} diff --git a/src/components/layout/index.ts b/src/components/layout/index.ts index e94c094..d848104 100644 --- a/src/components/layout/index.ts +++ b/src/components/layout/index.ts @@ -1,3 +1,4 @@ export { Navbar } from './Navbar'; export { Footer } from './Footer'; export { FancyCursor } from './FancyCursor'; +export { ScrollToTop } from './ScrollToTop'; diff --git a/src/pages/About.tsx b/src/pages/About.tsx index 043491f..928e421 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -1,4 +1,5 @@ import { motion } from 'motion/react'; +import { useLocation } from 'react-router-dom'; import { useTranslation } from '../i18n'; import { SiReact, @@ -27,7 +28,7 @@ const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, - transition: { staggerChildren: 0.1 }, + transition: { staggerChildren: 0.1, delayChildren: 0.6 }, }, }; @@ -42,9 +43,10 @@ const itemVariants = { export function About() { const { t } = useTranslation(); + const location = useLocation(); return ( -
+
{/* Hero Section */}
@@ -65,9 +67,8 @@ export function About() {

{t.about.intro}

{t.about.experience}

@@ -81,9 +82,8 @@ export function About() {

{t.about.skills.title}

{t.about.skills.subtitle}

@@ -93,8 +93,7 @@ export function About() { className={styles.techGrid} variants={containerVariants} initial="hidden" - whileInView="visible" - viewport={{ once: true }} + animate="visible" > {techStack.map((tech) => (