From 92ab3f26c4492e7786fc57f4bb47fd24e6d5ab40 Mon Sep 17 00:00:00 2001 From: Biswa Kalyan Bhuyan Date: Wed, 28 May 2025 20:13:39 +0530 Subject: feat: added the mobile friendly ui implimentation - added nav bar and added the morden layout to it - added mobile friendly css for responsiveness - added more other components to it --- frontend/src/components/theme-toggle.tsx | 79 +++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 16 deletions(-) (limited to 'frontend/src/components/theme-toggle.tsx') diff --git a/frontend/src/components/theme-toggle.tsx b/frontend/src/components/theme-toggle.tsx index 17df44e..53d8286 100644 --- a/frontend/src/components/theme-toggle.tsx +++ b/frontend/src/components/theme-toggle.tsx @@ -14,6 +14,26 @@ import { export function ThemeToggle() { const { setTheme, theme } = useTheme() + const [mounted, setMounted] = React.useState(false) + + // Ensure we only render the correct icon after mounting to avoid hydration mismatch + React.useEffect(() => { + setMounted(true) + }, []) + + if (!mounted) { + return ( + + ) + } return ( @@ -21,28 +41,55 @@ export function ThemeToggle() { - - setTheme("light")} className="flex items-center gap-2 nav-dropdown-item"> - - Light - {theme === "light" && } + + + setTheme("light")} + className="flex items-center gap-3 nav-dropdown-item cursor-pointer group/item" + > + + Light + {theme === "light" && ( + + )} - setTheme("dark")} className="flex items-center gap-2 nav-dropdown-item"> - - Dark - {theme === "dark" && } + + setTheme("dark")} + className="flex items-center gap-3 nav-dropdown-item cursor-pointer group/item" + > + + Dark + {theme === "dark" && ( + + )} - setTheme("system")} className="flex items-center gap-2 nav-dropdown-item"> - - System - {theme === "system" && } + + setTheme("system")} + className="flex items-center gap-3 nav-dropdown-item cursor-pointer group/item" + > + + System + {theme === "system" && ( + + )} -- cgit v1.2.3-59-g8ed1b