import clsx from 'clsx'; import React, { useState } from 'react'; import { BookConfig } from '@/types/book'; import { useSettingsStore } from '@/store/settingsStore'; import { useTranslation } from '@/hooks/useTranslation'; import { RiFontSize } from 'react-icons/ri'; import { RiDashboardLine } from 'react-icons/ri'; import { VscSymbolColor } from 'react-icons/vsc'; import { PiDotsThreeVerticalBold } from 'react-icons/pi'; import { IoAccessibilityOutline } from 'react-icons/io5'; import { MdArrowBackIosNew } from 'react-icons/md'; import FontPanel from './FontPanel'; import LayoutPanel from './LayoutPanel'; import ColorPanel from './ColorPanel'; import Dropdown from '@/components/Dropdown'; import Dialog from '@/components/Dialog'; import DialogMenu from './DialogMenu'; import MiscPanel from './MiscPanel'; type SettingsPanelType = 'Font' | 'Layout' | 'Color' | 'Misc'; type TabConfig = { tab: SettingsPanelType; icon: React.ElementType; label: string; }; const SettingsDialog: React.FC<{ bookKey: string; config: BookConfig }> = ({ bookKey }) => { const _ = useTranslation(); const [activePanel, setActivePanel] = useState('Font'); const { setFontLayoutSettingsDialogOpen } = useSettingsStore(); const tabConfig = [ { tab: 'Font', icon: RiFontSize, label: _('Font'), }, { tab: 'Layout', icon: RiDashboardLine, label: _('Layout'), }, { tab: 'Color', icon: VscSymbolColor, label: _('Color'), }, { tab: 'Misc', icon: IoAccessibilityOutline, label: _('Misc'), }, ] as TabConfig[]; const handleClose = () => { setFontLayoutSettingsDialogOpen(false); }; return ( <>
{tabConfig.map(({ tab, icon: Icon, label }) => ( ))}
} >
} > {activePanel === 'Font' && } {activePanel === 'Layout' && } {activePanel === 'Color' && } {activePanel === 'Misc' && }
); }; export default SettingsDialog;