@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
18 lines (17 loc) • 1.04 kB
JavaScript
import { jsx as r } from "react/jsx-runtime";
import { useCallback as a } from "react";
import { MoonIcon as h } from "../../../icons/MoonIcon.js";
import { SunIcon as c } from "../../../icons/SunIcon.js";
import { UIButton as k } from "../../../ui/Button.js";
import { useDarkModeContext as f } from "../../../../contexts/DarkModeContext.js";
import { useLocalizationContext as I } from "../../../../contexts/LocalizationContext.js";
import u from "../../../ui/RPTooltip.js";
const S = ({ icons: o }) => {
const { darkMode: e, setDarkMode: n } = f(), { localeMessages: t } = I(), i = o == null ? void 0 : o.lightModeIcon, d = o == null ? void 0 : o.darkModeIcon, m = e ? t == null ? void 0 : t.themeEnableLightTooltip : t == null ? void 0 : t.themeEnableDarkTooltip, l = a(() => {
n((p) => !p);
}, [n]);
return /* @__PURE__ */ r(u, { content: m, children: /* @__PURE__ */ r(k, { onClick: l, "aria-label": m, children: e ? d ?? /* @__PURE__ */ r(c, {}) : i ?? /* @__PURE__ */ r(h, {}) }) });
};
export {
S as ThemeSwitcherTool
};