From d9eba574be03dd7a918a4b20b1bf694b4a480d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=BCl=C3=B6p=20Kov=C3=A1cs?= <43729152+fulopkovacs@users.noreply.github.com> Date: Sun, 18 Jan 2026 13:33:43 +0100 Subject: [PATCH] The theme toggle should show the monitor icon when the `system` theme is selected --- src/components/mode-toggle.tsx | 58 +++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/src/components/mode-toggle.tsx b/src/components/mode-toggle.tsx index 8ec4491..e025ee3 100644 --- a/src/components/mode-toggle.tsx +++ b/src/components/mode-toggle.tsx @@ -1,38 +1,60 @@ import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react"; -import { useTheme } from "@/components/theme-provider"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, - DropdownMenuItem, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; +import { type UserTheme, useTheme } from "./theme-provider"; -export function ModeToggle() { - const { setTheme } = useTheme(); +type ThemeToggleProps = { + getTheme?: () => UserTheme; +}; + +function ThemeIcon({ theme }: { theme: UserTheme }) { + const iconClass = "h-[1.2rem] w-[1.2rem]"; + + if (theme === "system") { + return ; + } + if (theme === "dark") { + return ; + } + return ; +} + +export function ModeToggle({ getTheme }: ThemeToggleProps) { + const { setTheme, userTheme } = useTheme(); + const theme = getTheme ? getTheme() : userTheme; return ( - setTheme("light")}> - - Light - - setTheme("dark")}> - - Dark - - setTheme("system")}> - - System - + setTheme(value as UserTheme)} + > + + + Light + + + + Dark + + + + System + + );