-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from mfreeman451/136-featui-dark-mode
dark mode added
- Loading branch information
Showing
14 changed files
with
705 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
import React from 'react'; | ||
import React, {useEffect, useState} from 'react'; | ||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; | ||
import Navbar from './components/Navbar'; | ||
import Dashboard from './components/Dashboard'; | ||
import NodeList from './components/NodeList'; | ||
import ServiceDashboard from './components/ServiceDashboard'; | ||
|
||
function App() { | ||
const [darkMode, setDarkMode] = useState(false); | ||
|
||
// remember user preference in localStorage | ||
useEffect(() => { | ||
const savedMode = localStorage.getItem('darkMode'); | ||
if (savedMode) { | ||
setDarkMode(savedMode === 'true'); | ||
} | ||
}, []) | ||
|
||
useEffect(() => { | ||
localStorage.setItem('darkMode', darkMode); | ||
}, [darkMode]) | ||
|
||
return ( | ||
<Router> | ||
<div className="min-h-screen bg-gray-100"> | ||
<Navbar /> | ||
<main className="container mx-auto px-4 py-8"> | ||
<Routes> | ||
<Route path="/" element={<Dashboard />} /> | ||
<Route path="/nodes" element={<NodeList />} /> | ||
<Route path="/service/:nodeId/:serviceName" element={<ServiceDashboard />} /> | ||
</Routes> | ||
</main> | ||
</div> | ||
</Router> | ||
); | ||
} | ||
<div className={darkMode ? 'dark' : ''}> | ||
<Router> | ||
<div className="min-h-screen bg-gray-100 dark:bg-gray-900 transition-colors"> | ||
<Navbar darkMode={darkMode} setDarkMode={setDarkMode} /> | ||
<main className="container mx-auto px-4 py-8"> | ||
<Routes> | ||
<Route path="/" element={<Dashboard />} /> | ||
<Route path="/nodes" element={<NodeList />} /> | ||
<Route path="/service/:nodeId/:serviceName" element={<ServiceDashboard />} /> | ||
</Routes> | ||
</main> | ||
</div> | ||
</Router> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.