themes and dimensions

This commit is contained in:
Owen Rees
2023-06-12 15:41:09 +02:00
parent 95f0a37c76
commit 254d4603aa
18 changed files with 204 additions and 34 deletions
+23
View File
@@ -0,0 +1,23 @@
import { useEffect, useState } from "react";
function useDarkMode() {
const [theme, setTheme] = useState(
typeof window !== "undefined" ? localStorage.theme : "dark"
);
const colorTheme = theme === "dark" ? "light" : "dark";
useEffect(() => {
const root = window.document.documentElement;
root.classList.remove(colorTheme);
root.classList.add(theme);
if (typeof window !== "undefined") {
localStorage.setItem("theme", theme);
}
}, [theme]);
return [colorTheme, setTheme];
}
export default useDarkMode;
+1 -1
View File
@@ -25,7 +25,7 @@ const useTournamentDataFilter = (
} else {
state = filtered.map((t) => (
<tr
className="border-b border-gray-700 border-opacity-20 bg-gray-800 text-white transition duration-300 ease-in-out hover:bg-gray-400 hover:text-black"
className="text-gray-900 bg-white dark:bg-gray-800 dark:text-white hover:bg-gray-400 hover:text-black"
key={t._id}
>
<td className="p-3">