mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-28 19:06:19 -05:00
ui: theme picker in Settings, and ship the component gallery
The gallery at /theme-sample is now a normal route rather than a development one, and Settings links to it, so a user can see what a theme actually looks like before committing to it. Every new component belongs in the gallery: it is how the design gets reviewed, and how a component that only looks wrong in one of the four themes gets caught. Settings gains a Theme section with the new ThemePicker, which explains what each theme is for - notably that night mode filters videos, documents and maps to red as well, not just the interface. Theme names and picker options move to themes/names.ts so the component library can read them without importing components/Theme.tsx, which still pulls in Semantic UI. Theme.tsx re-exports them, so existing call sites are unchanged. The navigation bar's compact picker now reads the same list, so the two cannot drift apart. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
fb4c03d7a0
commit
95c089edc4
10 changed files with 290 additions and 52 deletions
|
|
@ -26,24 +26,21 @@ import {useBluetooth, useDesktop, useHotspot, useSearchDirectories, useSearchOrd
|
|||
import {Media, SettingsContext, StatusContext, ThemeContext} from "../contexts/contexts";
|
||||
import {
|
||||
Accordion,
|
||||
amberTheme,
|
||||
Breadcrumb,
|
||||
Button,
|
||||
Card as ThemedCard,
|
||||
Confirm,
|
||||
darkTheme,
|
||||
Form,
|
||||
Header,
|
||||
Icon,
|
||||
lightTheme,
|
||||
Loader,
|
||||
Menu,
|
||||
Modal,
|
||||
nightTheme,
|
||||
Popup,
|
||||
Segment,
|
||||
Statistic,
|
||||
systemTheme
|
||||
systemTheme,
|
||||
themeChoices
|
||||
} from "./Theme";
|
||||
import {FilePreviewContext} from "./FilePreview";
|
||||
import _ from "lodash";
|
||||
|
|
@ -1382,16 +1379,6 @@ export function LoadStatistic({label, value, cores, ...props}) {
|
|||
{...props}/>;
|
||||
}
|
||||
|
||||
// Theme picker entries. `night` and `amber` are only reachable here; neither is ever applied
|
||||
// automatically. See ui-design.md.
|
||||
const themeChoices = [
|
||||
{value: systemTheme, text: 'System', icon: 'lightbulb outline'},
|
||||
{value: lightTheme, text: 'Light', icon: 'sun'},
|
||||
{value: darkTheme, text: 'Dark', icon: 'moon'},
|
||||
{value: nightTheme, text: 'Night', icon: 'eye'},
|
||||
{value: amberTheme, text: 'Amber', icon: 'terminal'},
|
||||
];
|
||||
|
||||
export function DarkModeToggle() {
|
||||
const {savedTheme, setTheme} = useContext(ThemeContext);
|
||||
const active = themeChoices.find(i => i.value === savedTheme) || themeChoices[0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue