41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { BrowserRouter, Routes, Route, useLocation } from 'react-router-dom';
|
|
import { useEffect } from 'react';
|
|
import Navbar from './components/Navbar';
|
|
import Footer from './components/Footer';
|
|
import Home from './pages/Home';
|
|
import AllEvents from './pages/AllEvents';
|
|
import EventDetail from './pages/EventDetail';
|
|
|
|
function ScrollToTop() {
|
|
const { pathname } = useLocation();
|
|
|
|
useEffect(() => {
|
|
window.scrollTo(0, 0);
|
|
}, [pathname]);
|
|
|
|
return null;
|
|
}
|
|
|
|
function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<ScrollToTop />
|
|
<div className="min-h-screen bg-brutal-bg text-black font-sans selection:bg-brutal-pink selection:text-black flex flex-col">
|
|
<Navbar />
|
|
|
|
<main className="flex-1 flex flex-col">
|
|
<Routes>
|
|
<Route path="/" element={<Home />} />
|
|
<Route path="/events" element={<AllEvents />} />
|
|
<Route path="/event/:id" element={<EventDetail />} />
|
|
</Routes>
|
|
</main>
|
|
|
|
<Footer />
|
|
</div>
|
|
</BrowserRouter>
|
|
);
|
|
}
|
|
|
|
export default App;
|