@pdf-viewer/react
Version:
The PDF Viewer component for React and Next.js
32 lines (31 loc) • 1.79 kB
JavaScript
import { jsx as e, Fragment as u, jsxs as o } from "react/jsx-runtime";
import { G as p } from "../../../index-7279fb4e.js";
import { MenuSeparator as d } from "./MenuSeparator.js";
import { MenuItem as t } from "./MenuItem.js";
import { DualPageIcon as f } from "../../icons/SinglePageIcon.js";
import { SinglePageIcon as g } from "../../icons/DualPageIcon.js";
import { useViewModeContext as M } from "../../../contexts/ViewModeContext.js";
import { ScrollMode as h, ViewMode as i } from "../../../utils/types.js";
import { CheckIcon as l } from "../../icons/CheckIcon.js";
import { useToolbarComponentContext as I } from "../../../contexts/ToolbarComponentContext.js";
import { useScrollModeContext as S } from "../../../contexts/ScrollModeContext.js";
import { useMemo as C } from "react";
const N = () => /* @__PURE__ */ e(g, {}), x = () => /* @__PURE__ */ e(f, {}), V = () => {
const { viewMode: r, setDualPage: m, setSinglePage: c } = M(), { viewModeTool: s } = I(), { scrollMode: n } = S(), a = C(() => [h.HORIZONTAL_SCROLLING].includes(n), [n]);
return s ? /* @__PURE__ */ e(u, { children: /* @__PURE__ */ o(p, { children: [
/* @__PURE__ */ o(t, { onClick: c, children: [
/* @__PURE__ */ e("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ e(N, {}) }),
"Single page",
r === i.SINGLE_PAGE ? /* @__PURE__ */ e(l, { className: "rp-menu-item-right" }) : null
] }),
/* @__PURE__ */ o(t, { disabled: a, onClick: m, children: [
/* @__PURE__ */ e("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ e(x, {}) }),
"Dual page",
r === i.DUAL_PAGE ? /* @__PURE__ */ e(l, { className: "rp-menu-item-right" }) : null
] }),
/* @__PURE__ */ e(d, {})
] }) }) : null;
};
export {
V as ViewModeTool
};