-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.tsx
More file actions
60 lines (54 loc) · 1.66 KB
/
Copy pathApp.tsx
File metadata and controls
60 lines (54 loc) · 1.66 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
52
53
54
55
56
57
58
59
60
import React, { useEffect, useState } from 'react';
import { Routes, Route } from 'react-router-dom';
import Navbar from './components/Navbar';
import Hero from './components/Hero';
import About from './components/About';
import Future from './components/Future';
import Team from './components/Team';
import Footer from './components/Footer';
import BanList from './pages/BanList';
function App() {
const [isDark, setIsDark] = useState(true);
// Initialize theme
useEffect(() => {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
setIsDark(false);
}
document.body.classList.add('opacity-100');
document.body.classList.remove('opacity-0');
}, []);
// Update HTML class when theme changes
useEffect(() => {
if (isDark) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
}, [isDark]);
const toggleTheme = () => {
setIsDark(!isDark);
};
return (
<div className={`min-h-screen transition-colors duration-300 ${isDark ? 'bg-[#0f172a] text-white' : 'bg-slate-50 text-slate-900'} selection:bg-yellow-400 selection:text-black`}>
<Routes>
<Route
path="/"
element={
<>
<Navbar isDark={isDark} toggleTheme={toggleTheme} />
<main>
<Hero isDark={isDark} />
<About />
<Future />
<Team />
</main>
<Footer />
</>
}
/>
<Route path="/banlist" element={<><BanList /><Footer /></>} />
</Routes>
</div>
);
}
export default App;