udpate for coming soon
This commit is contained in:
@@ -6,11 +6,17 @@ type Theme = "dark" | "light";
|
||||
|
||||
const STORAGE_KEY = "theme";
|
||||
|
||||
type ThemeToggleProps = {
|
||||
label: string;
|
||||
lightLabel: string;
|
||||
darkLabel: string;
|
||||
};
|
||||
|
||||
function isTheme(value: string | null): value is Theme {
|
||||
return value === "dark" || value === "light";
|
||||
}
|
||||
|
||||
export default function ThemeToggle() {
|
||||
export default function ThemeToggle({ label, lightLabel, darkLabel }: ThemeToggleProps) {
|
||||
const [theme, setTheme] = useState<Theme>("dark");
|
||||
|
||||
useEffect(() => {
|
||||
@@ -34,9 +40,9 @@ export default function ThemeToggle() {
|
||||
type="button"
|
||||
onClick={handleToggle}
|
||||
className="theme-toggle"
|
||||
aria-label={`Switch to ${theme === "dark" ? "light" : "dark"} mode`}
|
||||
aria-label={`${label}: ${theme === "dark" ? lightLabel : darkLabel}`}
|
||||
>
|
||||
<span className="theme-toggle-label">{theme === "dark" ? "Light" : "Dark"}</span>
|
||||
<span className="theme-toggle-label">{theme === "dark" ? lightLabel : darkLabel}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user