diff --git a/src/app/globals.css b/src/app/globals.css index c36f85b..5a59bb6 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -17,6 +17,24 @@ --radius: 0.5rem; } - * { @apply border-border; } - body { @apply bg-background text-foreground; } + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + --card: 222.2 84% 7%; + --card-foreground: 210 40% 98%; + --primary: 142.1 70% 45%; + --primary-foreground: 144.9 80.4% 10%; + --secondary: 217.2 91.2% 59.8%; + --muted: 222.2 47% 11%; + --muted-foreground: 215 20.2% 65.1%; + --border: 217.2 32.6% 17.5%; + } + + * { + @apply border-border; + } + + body { + @apply bg-background text-foreground; + } } diff --git a/src/components/providers.tsx b/src/components/providers.tsx index 9bba174..3db1aff 100644 --- a/src/components/providers.tsx +++ b/src/components/providers.tsx @@ -1,20 +1,14 @@ "use client"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { useState } from "react"; +import { ThemeProvider } from "@/components/ui/theme-provider"; -export function Providers({ children }: { children: React.ReactNode }) { - const [queryClient] = useState( - () => new QueryClient({ - defaultOptions: { - queries: { staleTime: 30_000, retry: 2 }, - }, - }) - ); +const queryClient = new QueryClient(); +export function Providers({ children }: { children: React.ReactNode }) { return ( - - {children} - + + {children} + ); } diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsx index bdfc975..dd0b8a1 100644 --- a/src/components/ui/sidebar.tsx +++ b/src/components/ui/sidebar.tsx @@ -6,6 +6,7 @@ import { LayoutDashboard, Users, CreditCard, Vote, Landmark, BarChart3, Settings, } from "lucide-react"; import { clsx } from "clsx"; +import { ThemeToggle } from "@/components/ui/theme-toggle"; const navItems = [ { href: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, @@ -57,11 +58,14 @@ export function Sidebar() { })} - {/* Stellar indicator */} -
-
- - Stellar Testnet + {/* Stellar indicator + Theme toggle */} +
+
+
+ + Stellar Testnet +
+
diff --git a/src/components/ui/theme-provider.tsx b/src/components/ui/theme-provider.tsx new file mode 100644 index 0000000..c06a57b --- /dev/null +++ b/src/components/ui/theme-provider.tsx @@ -0,0 +1,8 @@ +"use client"; + +import { ThemeProvider as NextThemesProvider } from "next-themes"; +import type { ThemeProviderProps } from "next-themes/dist/types"; + +export function ThemeProvider({ children, ...props }: ThemeProviderProps) { + return {children}; +} diff --git a/src/components/ui/theme-toggle.tsx b/src/components/ui/theme-toggle.tsx new file mode 100644 index 0000000..04b2fa0 --- /dev/null +++ b/src/components/ui/theme-toggle.tsx @@ -0,0 +1,43 @@ +"use client"; + +import * as React from "react"; +import { Moon, Sun } from "lucide-react"; +import { useTheme } from "next-themes"; + +export function ThemeToggle() { + const { theme, setTheme } = useTheme(); + const [mounted, setMounted] = React.useState(false); + + React.useEffect(() => { + setMounted(true); + }, []); + + if (!mounted) { + return ( + + ); + } + + const isDark = theme === "dark"; + + return ( + + ); +}