feat: enhance the style of selection

This commit is contained in:
Li Xin
2025-04-24 16:37:35 +08:00
parent c7c9db1dbc
commit 9e07ed178d

View File

@@ -11,11 +11,12 @@ import {
DropdownMenuItem, DropdownMenuItem,
DropdownMenuTrigger, DropdownMenuTrigger,
} from "~/components/ui/dropdown-menu"; } from "~/components/ui/dropdown-menu";
import { cn } from "~/lib/utils";
import { Tooltip } from "./tooltip"; import { Tooltip } from "./tooltip";
export function ThemeToggle() { export function ThemeToggle() {
const { setTheme } = useTheme(); const { theme = "system", setTheme } = useTheme();
return ( return (
<DropdownMenu> <DropdownMenu>
@@ -30,15 +31,33 @@ export function ThemeToggle() {
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => setTheme("light")}> <DropdownMenuItem onClick={() => setTheme("light")}>
<Sun className="mr-2 h-4 w-4" /> <Sun className="mr-2 h-4 w-4" />
Light <span
className={cn(
theme === "light" ? "font-bold" : "text-muted-foreground",
)}
>
Light
</span>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("dark")}> <DropdownMenuItem onClick={() => setTheme("dark")}>
<Moon className="mr-2 h-4 w-4" /> <Moon className="mr-2 h-4 w-4" />
Dark <span
className={cn(
theme === "dark" ? "font-bold" : "text-muted-foreground",
)}
>
Dark
</span>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("system")}> <DropdownMenuItem onClick={() => setTheme("system")}>
<Monitor className="mr-2 h-4 w-4" /> <Monitor className="mr-2 h-4 w-4" />
System <span
className={cn(
theme === "system" ? "font-bold" : "text-muted-foreground",
)}
>
System
</span>
</DropdownMenuItem> </DropdownMenuItem>
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>