mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 23:16:49 +00:00
reading resources
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
/**
|
||||
* 主题文件被加载出之前的占位符
|
||||
* @returns
|
||||
*/
|
||||
const Loading = (props) => {
|
||||
const { current } = props
|
||||
const { theme, setOnReading } = useGlobal()
|
||||
|
||||
return <>
|
||||
{current || <div className="w-screen h-screen flex justify-center items-center bg-white dark:bg-black">
|
||||
<h1>Loading... <i className='ml-2 fas fa-spinner animate-spin' /></h1>
|
||||
</div>}
|
||||
</>
|
||||
useEffect(() => {
|
||||
// 返回一个函数,在组件销毁时设置 onReading 为 false
|
||||
return () => {
|
||||
setOnReading(false)
|
||||
}
|
||||
}, [theme])
|
||||
|
||||
return <div className="w-screen h-screen flex justify-center items-center dark:bg-black text-black dark:text-white">
|
||||
<h1 className="text-2xl"><i className='mr-5 fas fa-spinner animate-spin' />Loading...</h1>
|
||||
</div>
|
||||
}
|
||||
export default Loading
|
||||
|
||||
Reference in New Issue
Block a user