used daisyUI for dark mode

This commit is contained in:
daniel31x13
2023-11-24 07:50:16 -05:00
parent b8b6fe24bc
commit 3afd5fef6e
14 changed files with 105 additions and 48 deletions
+15 -1
View File
@@ -12,10 +12,13 @@ import ProfilePhoto from "@/components/ProfilePhoto";
import useModalStore from "@/store/modals";
import useWindowDimensions from "@/hooks/useWindowDimensions";
import ToggleDarkMode from "./ToggleDarkMode";
import useLocalSettingsStore from "@/store/localSettings";
export default function Navbar() {
const { setModal } = useModalStore();
const { settings, updateSettings } = useLocalSettingsStore();
const { account } = useAccountStore();
const [profileDropdown, setProfileDropdown] = useState(false);
@@ -26,6 +29,14 @@ export default function Navbar() {
const { width } = useWindowDimensions();
const handleToggle = () => {
if (settings.theme === "dark") {
updateSettings({ theme: "light" });
} else {
updateSettings({ theme: "dark" });
}
};
useEffect(() => {
setSidebar(false);
}, [width]);
@@ -95,9 +106,12 @@ export default function Navbar() {
href: "/settings/account",
},
{
name: `Switch to ${"light" ? "Dark" : "Light"}`,
name: `Switch to ${
settings.theme === "light" ? "Dark" : "Light"
}`,
onClick: () => {
setProfileDropdown(!profileDropdown);
handleToggle();
},
},
{