The theme toggle should show the monitor icon when the `system` theme is selected #45
Openfukowants to merge 0 commits into
main fromfix-theme-selector-dropdown-toggleopened View on GitHub- src/components/mode-toggle.tsx lines 12 to 14@@ -1,12 +1,14 @@11 import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";2-import { useTheme } from "@/components/theme-provider";32 import { Button } from "@/components/ui/button";43 import {54 DropdownMenu,65 DropdownMenuContent,7- DropdownMenuItem,6+ DropdownMenuRadioGroup,7+ DropdownMenuRadioItem,88 DropdownMenuTrigger,99 } from "@/components/ui/dropdown-menu";10+import { type UserTheme, useTheme } from "./theme-provider";101111-export function ModeToggle() {12- const { setTheme } = useTheme();12+type ThemeToggleProps = {13+ getTheme?: () => UserTheme;14+};
Sign in to join this conversation.
Walkthrough#
The ModeToggle component is refactored to introduce an optional
getThemeprop, implement a new ThemeIcon component for dynamic icon rendering, and replace static dropdown menu items with a DropdownMenuRadioGroup for theme selection. The trigger icon now reflects the currently active theme.Changes#
src/components/mode-toggle.tsxgetThemeprop to ModeToggle with theme provider fallback; introduces ThemeIcon component for dynamic icon rendering; replaces three static DropdownMenuItems with DropdownMenuRadioGroup for theme selection; updates trigger to display active theme icon.Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share