import clsx from 'clsx'; import React from 'react'; import { IoIosList, IoMdCloseCircle } from 'react-icons/io'; import { MdChevronLeft, MdChevronRight } from 'react-icons/md'; import { Insets } from '@/types/misc'; import { useEnv } from '@/context/EnvContext'; import { useTranslation } from '@/hooks/useTranslation'; import { useResponsiveSize } from '@/hooks/useResponsiveSize'; import { useReaderStore } from '@/store/readerStore'; interface ContentNavBarProps { bookKey: string; gridInsets: Insets; title: string; section?: string; progress?: number; // 0 to 1, where 1 means complete showListButton?: boolean; hasPrevious: boolean; hasNext: boolean; previousLabel?: string; nextLabel?: string; previousTitle?: string; nextTitle?: string; showResultsTitle?: string; closeTitle?: string; onShowResults?: () => void; onClose: () => void; onPrevious: () => void; onNext: () => void; } const ContentNavBar: React.FC = ({ bookKey, gridInsets, title, section, progress, showListButton = true, hasPrevious, hasNext, previousTitle, nextTitle, showResultsTitle, closeTitle, onShowResults, onClose, onPrevious, onNext, }) => { const { appService } = useEnv(); const _ = useTranslation(); const { getViewSettings } = useReaderStore(); const viewSettings = getViewSettings(bookKey); const iconSize16 = useResponsiveSize(16); const iconSize20 = useResponsiveSize(20); const showSection = appService?.isMobile || !viewSettings?.showHeader; return (
{/* Bottom bar: Navigation buttons and Info */}
{/* Previous button */} {/* Info bar */}
{progress !== undefined && progress < 1 && (
)} {progress === 1 &&
} {showListButton && onShowResults ? ( ) : (
)}
{title} {section && showSection && ( {section} )}
{/* Next button */}
); }; export default ContentNavBar;