import { useGlobal } from '@/lib/global' import { Moon, Sun } from './HeroIcons' import { useImperativeHandle } from 'react' /** * 深色模式按钮 */ const DarkModeButton = (props) => { const { cRef, className } = props const { isDarkMode, toggleDarkMode } = useGlobal() /** * 对外暴露方法 */ useImperativeHandle(cRef, () => { return { handleChangeDarkMode: () => { toggleDarkMode() } } }) return
{isDarkMode ? : }
} export default DarkModeButton