mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-15 15:09:25 +00:00
Merge pull request #432 from tangly1024/bug/from-themes
Bug/from themes
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import busuanzi from '@/lib/busuanzi'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect } from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
// import { useRouter } from 'next/router'
|
||||
import React from 'react'
|
||||
|
||||
export default function Busuanzi () {
|
||||
const { theme } = useGlobal()
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
|
||||
// 切换文章时更新
|
||||
React.useEffect(() => {
|
||||
const busuanziRouteChange = url => {
|
||||
busuanzi.fetch()
|
||||
}
|
||||
@@ -13,5 +18,12 @@ export default function Busuanzi () {
|
||||
router.events.off('routeChangeComplete', busuanziRouteChange)
|
||||
}
|
||||
}, [router.events])
|
||||
|
||||
// 更换主题时更新
|
||||
React.useEffect(() => {
|
||||
if (theme) {
|
||||
busuanzi.fetch()
|
||||
}
|
||||
})
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function getGlobalNotionData({
|
||||
* @returns
|
||||
*/
|
||||
function getLatestPosts({ allPages, from, latestPostCount }) {
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
|
||||
const latestPosts = Object.create(allPosts).sort((a, b) => {
|
||||
const dateA = new Date(a?.lastEditedTime || a?.createdTime || a?.date?.start_date)
|
||||
|
||||
@@ -12,7 +12,7 @@ const InfoCard = (props) => {
|
||||
<img src={siteInfo?.icon} className='rounded-full' width={120}/>
|
||||
</div>
|
||||
<div className='text-2xl font-serif dark:text-white py-2 hover:scale-105 transform duration-200'>{BLOG.AUTHOR}</div>
|
||||
<div className='font-light dark:text-white py-2 hover:scale-105 transform duration-200'>{BLOG.BIO}</div>
|
||||
<div className='font-light dark:text-white py-2 hover:scale-105 transform duration-200 text-center'>{BLOG.BIO}</div>
|
||||
<SocialButton/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -6,7 +6,7 @@ const Logo = props => {
|
||||
return <Link href='/' passHref>
|
||||
<div className={'flex flex-col justify-center items-center cursor-pointer bg-black space-y-3 font-bold ' + className}>
|
||||
<div className='font-serif text-xl text-white'> {siteInfo?.title}</div>
|
||||
<div className='text-sm text-gray-300 font-light'> {siteInfo?.description}</div>
|
||||
<div className='text-sm text-gray-300 font-light text-center'> {siteInfo?.description}</div>
|
||||
</div>
|
||||
</Link>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user