import { Button, Dropdown, Modal, Space, Typography } from "antd"; import { DoubleRightOutlined, DoubleLeftOutlined } from "@ant-design/icons"; import { FolderOutlined } from "@ant-design/icons"; import type { ITocPathNode } from "../corpus/TocPath" const { Paragraph, Text } = Typography; const EllipsisMiddle: React.FC<{ suffixCount: number; maxWidth: number; text?: string; }> = ({ suffixCount, maxWidth = 500, text = "" }) => { const start = text.slice(0, text.length - suffixCount).trim(); const suffix = text.slice(-suffixCount).trim(); return ( {start} ); }; interface IWidget { prevTitle?: string; nextTitle?: string; path?: ITocPathNode[]; topOfChapter?: boolean; endOfChapter?: boolean; onPrev?: Function; onNext?: Function; onPathChange?: Function; } const NavigateButtonWidget = ({ prevTitle, nextTitle, topOfChapter = false, endOfChapter = false, path, onPrev, onNext, onPathChange, }: IWidget) => { const currTitle = path && path.length > 0 ? path[path.length - 1].title : ""; return (
{ return { label: item.title, key: item.key ?? item.title }; }), onClick: (e) => { console.debug("onPathChange", e.key); if (typeof onPathChange !== "undefined") { onPathChange(e.key); } }, }} > {currTitle}
); }; export default NavigateButtonWidget;