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
23 lines • 746 B
JavaScript
import { ThemeSwitch as ThemeSwitchButton } from '@lobehub/ui';
import { usePrefersColor } from 'dumi';
import { memo, useEffect } from 'react';
import { useThemeStore } from "../../store/useThemeStore";
import { jsx as _jsx } from "react/jsx-runtime";
var ThemeSwitch = /*#__PURE__*/memo(function () {
var themeMode = useThemeStore(function (s) {
return s.themeMode;
});
var setColorMode = usePrefersColor()[2];
useEffect(function () {
return setColorMode(themeMode);
}, [themeMode]);
return /*#__PURE__*/_jsx(ThemeSwitchButton, {
onThemeSwitch: function onThemeSwitch(themeMode) {
useThemeStore.setState({
themeMode: themeMode
});
},
themeMode: themeMode
});
});
export default ThemeSwitch;