Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

Persistant Dark/Light mode.

Daniel2114c03c290f
diff --git a/src/App.js b/src/App.js
index 9f548830..c4c7fdb2 100644
--- a/src/App.js
+++ b/src/App.js
@@ -23,7 +23,7 @@ function App() {
[tagsChecked, setTagsChecked] = useState(true),
[sortBy, setSortBy] = useState('Default'),
[loader, setLoader] = useState(false),
- [lightMode, setLightMode] = useState(false);
+ [lightMode, setLightMode] = useState(localStorage.getItem('light-mode') === 'true');
function SetLoader(x) {
setLoader(x)
@@ -82,13 +82,26 @@ function App() {
setNumberOfResults(filteredData.length);
}, [filteredData]);
+ // useEffect(() => {
+ // const isLight = localStorage.getItem("light-mode");
+
+ // if (JSON.parse(isLight)) {
+ // setLightMode(true);
+ // } else {
+ // setLightMode(false);
+ // }
+ // }, []);
+
useEffect(() => {
if (lightMode) {
document.body.classList.add("light");
} else {
document.body.classList.remove("light");
}
+
+ localStorage.setItem('light-mode', lightMode);
}, [lightMode]);
+
return (
<div className="App">