mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 19:32:25 +00:00
- Convert all analytics components to use shadcn Card and semantic colors - Update RawTransactionModal with proper shadcn styling and theme support - Fix all remaining hardcoded colors to use CSS variables (bg-card, text-foreground, etc.) - Ensure consistent theming across light/dark modes for all components - Add custom tooltips with semantic colors for chart components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { Monitor, Moon, Sun } from "lucide-react";
|
|
import { Button } from "./button";
|
|
import { useTheme } from "../../contexts/ThemeContext";
|
|
|
|
export function ThemeToggle() {
|
|
const { theme, setTheme } = useTheme();
|
|
|
|
const cycleTheme = () => {
|
|
if (theme === "light") {
|
|
setTheme("dark");
|
|
} else if (theme === "dark") {
|
|
setTheme("system");
|
|
} else {
|
|
setTheme("light");
|
|
}
|
|
};
|
|
|
|
const getIcon = () => {
|
|
switch (theme) {
|
|
case "light":
|
|
return <Sun className="h-4 w-4" />;
|
|
case "dark":
|
|
return <Moon className="h-4 w-4" />;
|
|
case "system":
|
|
return <Monitor className="h-4 w-4" />;
|
|
}
|
|
};
|
|
|
|
const getLabel = () => {
|
|
switch (theme) {
|
|
case "light":
|
|
return "Switch to dark mode";
|
|
case "dark":
|
|
return "Switch to system mode";
|
|
case "system":
|
|
return "Switch to light mode";
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
size="icon"
|
|
onClick={cycleTheme}
|
|
className="h-8 w-8"
|
|
title={getLabel()}
|
|
>
|
|
{getIcon()}
|
|
<span className="sr-only">{getLabel()}</span>
|
|
</Button>
|
|
);
|
|
}
|