import { useState } from 'preact/hooks'; import type { Bar } from '@wutzcalc/shared'; import { getTheme, setTheme } from '../api'; import { VersionFooter } from '../VersionFooter'; interface Props { bars: Bar[] | null; onPick: (id: number) => void; } export function BarPicker({ bars, onPick }: Props) { const [theme, setThemeState] = useState(getTheme()); function toggleTheme() { const next = theme === 'dark' ? 'light' : 'dark'; setTheme(next); setThemeState(next); } return (
); }