From 92ab3f26c4492e7786fc57f4bb47fd24e6d5ab40 Mon Sep 17 00:00:00 2001
From: Biswa Kalyan Bhuyan <biswa@surgot.in>
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 (
+      <Button 
+        variant="ghost" 
+        size="icon" 
+        className="nav-button-transparent backdrop-blur-sm relative overflow-hidden transition-all duration-300 hover:scale-105 active:scale-95"
+        disabled
+      >
+        <Monitor className="h-[1.1rem] w-[1.1rem] text-muted-foreground/60" />
+        <span className="sr-only">Toggle theme</span>
+      </Button>
+    )
+  }
 
   return (
     <DropdownMenu>
@@ -21,28 +41,55 @@ export function ThemeToggle() {
         <Button 
           variant="ghost" 
           size="icon" 
-          className="nav-button-transparent backdrop-blur-sm"
+          className="nav-button-transparent backdrop-blur-sm relative overflow-hidden transition-all duration-300 hover:scale-105 active:scale-95 group"
         >
-          <Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
-          <Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
+          {/* Enhanced icon transitions with better positioning */}
+          <Sun className="h-[1.1rem] w-[1.1rem] rotate-0 scale-100 transition-all duration-500 ease-in-out dark:-rotate-180 dark:scale-0 text-amber-500 dark:text-amber-400 group-hover:text-amber-600 dark:group-hover:text-amber-300" />
+          <Moon className="absolute h-[1.1rem] w-[1.1rem] rotate-180 scale-0 transition-all duration-500 ease-in-out dark:rotate-0 dark:scale-100 text-blue-600 dark:text-blue-400 group-hover:text-blue-700 dark:group-hover:text-blue-300" />
+          
+          {/* Subtle background glow effect on hover */}
+          <div className="absolute inset-0 rounded-full bg-gradient-to-r from-amber-500/0 to-blue-500/0 group-hover:from-amber-500/10 group-hover:to-blue-500/10 dark:group-hover:from-amber-400/10 dark:group-hover:to-blue-400/10 transition-all duration-300" />
+          
           <span className="sr-only">Toggle theme</span>
         </Button>
       </DropdownMenuTrigger>
-      <DropdownMenuContent align="end" className="nav-dropdown-transparent">
-        <DropdownMenuItem onClick={() => setTheme("light")} className="flex items-center gap-2 nav-dropdown-item">
-          <Sun className="h-4 w-4" />
-          Light
-          {theme === "light" && <span className="ml-auto text-xs">✓</span>}
+      
+      <DropdownMenuContent 
+        align="end" 
+        className="nav-dropdown-transparent min-w-[140px] animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-200"
+        sideOffset={8}
+      >
+        <DropdownMenuItem 
+          onClick={() => setTheme("light")} 
+          className="flex items-center gap-3 nav-dropdown-item cursor-pointer group/item"
+        >
+          <Sun className="h-4 w-4 text-amber-500 group-hover/item:text-amber-600 transition-colors duration-200" />
+          <span className="flex-1">Light</span>
+          {theme === "light" && (
+            <span className="text-xs text-emerald-600 dark:text-emerald-400 font-medium animate-in fade-in-0 scale-in-75 duration-200">✓</span>
+          )}
         </DropdownMenuItem>
-        <DropdownMenuItem onClick={() => setTheme("dark")} className="flex items-center gap-2 nav-dropdown-item">
-          <Moon className="h-4 w-4" />
-          Dark
-          {theme === "dark" && <span className="ml-auto text-xs">✓</span>}
+        
+        <DropdownMenuItem 
+          onClick={() => setTheme("dark")} 
+          className="flex items-center gap-3 nav-dropdown-item cursor-pointer group/item"
+        >
+          <Moon className="h-4 w-4 text-blue-600 dark:text-blue-400 group-hover/item:text-blue-700 dark:group-hover/item:text-blue-300 transition-colors duration-200" />
+          <span className="flex-1">Dark</span>
+          {theme === "dark" && (
+            <span className="text-xs text-emerald-600 dark:text-emerald-400 font-medium animate-in fade-in-0 scale-in-75 duration-200">✓</span>
+          )}
         </DropdownMenuItem>
-        <DropdownMenuItem onClick={() => setTheme("system")} className="flex items-center gap-2 nav-dropdown-item">
-          <Monitor className="h-4 w-4" />
-          System
-          {theme === "system" && <span className="ml-auto text-xs">✓</span>}
+        
+        <DropdownMenuItem 
+          onClick={() => setTheme("system")} 
+          className="flex items-center gap-3 nav-dropdown-item cursor-pointer group/item"
+        >
+          <Monitor className="h-4 w-4 text-slate-600 dark:text-slate-400 group-hover/item:text-slate-700 dark:group-hover/item:text-slate-300 transition-colors duration-200" />
+          <span className="flex-1">System</span>
+          {theme === "system" && (
+            <span className="text-xs text-emerald-600 dark:text-emerald-400 font-medium animate-in fade-in-0 scale-in-75 duration-200">✓</span>
+          )}
         </DropdownMenuItem>
       </DropdownMenuContent>
     </DropdownMenu>
-- 
cgit v1.2.3-59-g8ed1b

