'use client'; import { MinusSquare, Moon, PlusSquare, Search, Sun, Type } from 'lucide-react'; import { shallow } from 'zustand/shallow'; import { useSearchStore } from '@/stores/search-store'; import { useThemeStore } from '@/stores/theme-store'; import { Tooltip } from '@/components/tooltip'; import { cn } from '@/lib/utils'; type ToolbarProps = { fontControls: boolean; className?: string; }; export function Toolbar({ fontControls, className }: ToolbarProps) { const toggleSearch = useSearchStore((state) => state.toggleSearch); const isSearching = useSearchStore((state) => state.isSearching); const { isDark, isSerif, isFontSizeMin, isFontSizeMax, toggleDark, toggleSerif, increaseFontSize, decreaseFontSize, } = useThemeStore( (state) => ({ isDark: state.isDark, isSerif: state.isSerif, isFontSizeMin: state.isFontSizeMin, isFontSizeMax: state.isFontSizeMax, toggleDark: state.toggleDark, toggleSerif: state.toggleSerif, increaseFontSize: state.increaseFontSize, decreaseFontSize: state.decreaseFontSize, }), shallow, ); const toggleDarkAndApply = () => { toggleDark(); document.querySelector('html')?.classList.toggle('dark'); }; return (
{fontControls && ( <> )}
); }