Files
wiki/src/components/ThemeToggle.tsx
Wayne Sutton 462729de58 chore: prepare v1.0.0 for Netlify deployment
Update version to 1.0.0 across package.json and changelog. Configure netlify.toml with Convex deployment URL (agreeable-trout-200.convex.site). Verify TypeScript type-safety for src and convex directories. Confirm Netlify build passes with SPA 404 fallback configured. Update TASK.md with deployment steps and files.md with complete file structure.
2025-12-14 11:30:22 -08:00

50 lines
1.2 KiB
TypeScript

import { useTheme } from "../context/ThemeContext";
import { Moon, Sun, Cloud } from "lucide-react";
import { Half2Icon } from "@radix-ui/react-icons";
// Theme toggle component using same icons as Better Todo app
// Icons: Moon (dark), Sun (light), Half2Icon (tan), Cloud (cloud)
export default function ThemeToggle() {
const { theme, toggleTheme } = useTheme();
// Get the appropriate icon for current theme
const getIcon = () => {
switch (theme) {
case "dark":
return <Moon size={18} />;
case "light":
return <Sun size={18} />;
case "tan":
// Half2Icon from Radix uses different sizing
return <Half2Icon style={{ width: 18, height: 18 }} />;
case "cloud":
return <Cloud size={18} />;
}
};
// Get theme label for accessibility
const getLabel = () => {
switch (theme) {
case "dark":
return "Dark";
case "light":
return "Light";
case "tan":
return "Tan";
case "cloud":
return "Cloud";
}
};
return (
<button
onClick={toggleTheme}
className="theme-toggle"
aria-label={`Current theme: ${getLabel()}. Click to toggle.`}
title={`Theme: ${getLabel()}`}
>
{getIcon()}
</button>
);
}