mirror of
https://github.com/HananoshikaYomaru/openfreebooks.git
synced 2026-11-13 13:05:51 +00:00
Update zola.toml to include site title, description, theme, and additional URLs for navigation
This commit is contained in:
parent
5548bfce90
commit
ab87bc2bd1
59 changed files with 4068 additions and 1 deletions
30
frontend/src/components/theme-toggle.tsx
Normal file
30
frontend/src/components/theme-toggle.tsx
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { createSignal, onMount, Show } from "solid-js";
|
||||
import { resolveTheme, setTheme, type ThemeChoice } from "../theme";
|
||||
|
||||
export function ThemeToggle() {
|
||||
const [theme, setThemeState] = createSignal<ThemeChoice>("light");
|
||||
|
||||
onMount(() => {
|
||||
setThemeState(resolveTheme());
|
||||
});
|
||||
|
||||
const toggle = () => {
|
||||
const next: ThemeChoice = theme() === "dark" ? "light" : "dark";
|
||||
setTheme(next);
|
||||
setThemeState(next);
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
class="theme-toggle"
|
||||
onClick={toggle}
|
||||
aria-label={theme() === "dark" ? "Switch to light theme" : "Switch to dark theme"}
|
||||
title={theme() === "dark" ? "Light mode" : "Dark mode"}
|
||||
>
|
||||
<Show when={theme() === "dark"} fallback={<span aria-hidden="true">☾</span>}>
|
||||
<span aria-hidden="true">☀</span>
|
||||
</Show>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue