-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
51 lines (45 loc) · 1.42 KB
/
Copy pathApp.tsx
File metadata and controls
51 lines (45 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React, { useEffect } from 'react';
import { HashRouter as Router, Routes, Route, useLocation } from 'react-router-dom';
import Navbar from './components/Navbar';
import Footer from './components/Footer';
import Home from './pages/Home';
import Solutions from './pages/Solutions';
import About from './pages/About';
import News from './pages/News';
import Contact from './pages/Contact';
import { AppProvider } from './contexts/AppContext';
const ScrollToTop = () => {
const { pathname } = useLocation();
useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
return null;
};
const AppContent: React.FC = () => {
return (
<div className="flex flex-col min-h-screen bg-slate-50 dark:bg-slate-950 text-slate-900 dark:text-white font-sans antialiased selection:bg-brand-primary selection:text-white transition-colors duration-300">
<Navbar />
<main className="flex-grow">
<Routes>
<Route path="/" element={<Home />} />
<Route path="/solutions" element={<Solutions />} />
<Route path="/about" element={<About />} />
<Route path="/news" element={<News />} />
<Route path="/contact" element={<Contact />} />
</Routes>
</main>
<Footer />
</div>
);
};
const App: React.FC = () => {
return (
<AppProvider>
<Router>
<ScrollToTop />
<AppContent />
</Router>
</AppProvider>
);
};
export default App;