"use client"; import { ALargeSmall, Columns2, Minus, Plus, RotateCcw, Rows3, SunMoon, type LucideIcon, } from "lucide-react"; import { useTranslation } from "react-i18next"; import Tooltip from "@/shared/ui/Tooltip"; import { DEFAULT_READER_DISPLAY_PREFERENCES, MAX_FONT_SIZE, MIN_FONT_SIZE, MIN_LINE_WIDTH, type ReaderDisplayPreferences, } from "@/lib/reading-display-preferences"; const LINE_WIDTH_STEPS = [48, 64, 84, 104]; export function PreferenceButton({ label, icon: Icon, active = false, disabled = false, onClick, }: { label: string; icon: LucideIcon; active?: boolean; disabled?: boolean; onClick: () => void; }) { return ( ); } /** The text and native EPUB readers share one display preference contract. */ export function ReaderDisplayControls({ preferences, onChange, showSpread = false, }: { preferences: ReaderDisplayPreferences; onChange: (next: Partial) => void; showSpread?: boolean; }) { const { t } = useTranslation(); const { fontSize, lineWidth, serif, readerTheme, spreadMode } = preferences; return (
onChange({ fontSize: Math.max(MIN_FONT_SIZE, fontSize - 1) })} /> = MAX_FONT_SIZE} onClick={() => onChange({ fontSize: Math.min(MAX_FONT_SIZE, fontSize + 1) })} /> onChange({ serif: !serif })} /> onChange({ lineWidth: LINE_WIDTH_STEPS.find((width) => width > lineWidth) ?? MIN_LINE_WIDTH, }) } /> onChange({ readerTheme: readerTheme === "auto" ? "sepia" : readerTheme === "sepia" ? "night" : "auto", }) } /> {showSpread && ( onChange({ spreadMode: spreadMode === "none" ? "auto" : "none" }) } /> )} onChange(DEFAULT_READER_DISPLAY_PREFERENCES)} />
); }