dumi-theme-lobehub
Version:
dumi-theme-lobehub is a documentation site theme package designed for dumi2. It provides a more beautiful and user-friendly development and reading experience based on @lobehub/ui
31 lines (30 loc) • 1.25 kB
JavaScript
import { ThemeProvider } from '@lobehub/ui';
import { StyleProvider, extractStaticStyle } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import GlobalStyle from "./GlobalStyle";
import { siteSelectors, useSiteStore, useThemeStore } from "../../store";
import _customToken from "../../styles/customToken";
import AntdV5MonkeyPatch from "./AntdV5MonkeyPatch";
//@ts-ignore
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
global.__ANTD_CACHE__ = extractStaticStyle.cache;
export default /*#__PURE__*/memo(function (_ref) {
var children = _ref.children;
var themeMode = useThemeStore(function (st) {
return st.themeMode;
});
var userToken = useSiteStore(siteSelectors.token, isEqual);
return /*#__PURE__*/_jsxs(StyleProvider, {
cache: extractStaticStyle.cache,
speedy: process.env.NODE_ENV === 'production',
children: [/*#__PURE__*/_jsxs(ThemeProvider, {
customToken: function customToken(themeToken) {
return Object.assign({}, _customToken(themeToken), userToken);
},
themeMode: themeMode,
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), children]
}), /*#__PURE__*/_jsx(AntdV5MonkeyPatch, {})]
});
});