Jade-Infra-test / src /App.jsx
rushiljain's picture
Upload 29 files
691cdd0 verified
import React, { useEffect } from 'react';
import { Routes, Route, useLocation } from 'react-router-dom';
import Header from './components/Header.jsx';
import Footer from './components/Footer.jsx';
import Home from './pages/Home.jsx';
import About from './pages/About.jsx';
import ProjectsSection from './pages/ProjectsSection.jsx';
import ProjectDetail from './pages/ProjectDetail.jsx';
import Contact from './pages/Contact.jsx';
import DotCursor from './components/DotCursor.jsx';
export default function App() {
const { pathname, hash } = useLocation();
useEffect(() => {
if (hash) {
const el = document.querySelector(hash);
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' });
} else {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
}, [pathname, hash]);
return (
<div className="flex min-h-screen flex-col">
<Header />
<main id="main-content" className="flex-1 focus:outline-none" tabIndex={-1}>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
<Route path="/projects/:sectionId" element={<ProjectsSection />} />
<Route path="/project/:slug" element={<ProjectDetail />} />
<Route path="/contact" element={<Contact />} />
</Routes>
</main>
<Footer />
<DotCursor />
</div>
);
}