Skip to content

Commit

Permalink
Merge pull request #242 from tangly1024/preview
Browse files Browse the repository at this point in the history
代码封装优化,Header颜色微调
  • Loading branch information
tangly1024 authored May 13, 2022
2 parents eaa6b90 + 145f16e commit a3f2494
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 8 deletions.
3 changes: 1 addition & 2 deletions components/Comment.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import BLOG from '@/blog.config'
import dynamic from 'next/dynamic'
import { useRouter } from 'next/router'
import 'gitalk/dist/gitalk.css'
import Tabs from '@/components/Tabs'
import { ReactCusdis } from 'react-cusdis'
import { useGlobal } from '@/lib/global'

const GitalkComponent = dynamic(
() => {
return import('gitalk/dist/gitalk-component')
return import('@/components/Gitalk')
},
{ ssr: false }
)
Expand Down
9 changes: 9 additions & 0 deletions components/Gitalk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'gitalk/dist/gitalk.css'

import GitalkComponent from 'gitalk/dist/gitalk-component'

const Gitalk = props => {
return <GitalkComponent {...props} />
}

export default Gitalk
8 changes: 6 additions & 2 deletions components/Live2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default function Live2D() {
}

useEffect(() => {
initLive2D()
window.addEventListener('scroll', initLive2D)
return () => {
window.removeEventListener('scroll', initLive2D)
}
}, [])

return <canvas id="live2d" className='cursor-pointer' width="280" height="250" onClick={handleClick} alt='切换主题' title='切换主题' />
Expand All @@ -27,6 +30,7 @@ export default function Live2D() {
* 加载宠物
*/
function initLive2D() {
window.removeEventListener('scroll', initLive2D)
setTimeout(() => {
// 加载 waifu.css live2d.min.js waifu-tips.js
if (screen.width >= 768) {
Expand All @@ -38,5 +42,5 @@ function initLive2D() {
loadlive2d('live2d', BLOG.WIDGET_PET_LINK)
})
}
}, 1000)
}, 300)
}
2 changes: 2 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module.exports = withBundleAnalyzer({
webpack5: true
},
images: {
// 图片压缩
formats: ['image/avif', 'image/webp'],
// 允许next/image加载的图片 域名
domains: [
'gravatar.com',
Expand Down
2 changes: 1 addition & 1 deletion pages/article/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Slug = props => {
const article = document.getElementById('container')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
// console.warn('找不到页面', router.asPath)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion themes/hexo/Layout404.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Layout404 = props => {
const article = typeof document !== 'undefined' && document.getElementById('container')
if (!article) {
router.push('/').then(() => {
console.log('找不到页面', router.asPath)
// console.log('找不到页面', router.asPath)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion themes/hexo/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const Header = props => {
className="duration-500 md:bg-fixed w-full bg-cover bg-center h-screen bg-black text-white"
style={{
backgroundImage:
`linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${siteInfo?.pageCover}")`
`linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0,0,0,0.2), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${siteInfo?.pageCover}")`
}}
>
<div className="absolute flex flex-col h-full items-center justify-center w-full font-sans">
Expand Down
2 changes: 1 addition & 1 deletion themes/next/Layout404.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Layout404 = props => {
const article = typeof document !== 'undefined' && document.getElementById('container')
if (!article) {
router.push('/').then(() => {
console.log('找不到页面', router.asPath)
// console.log('找不到页面', router.asPath)
})
}
}
Expand Down

1 comment on commit a3f2494

@vercel
Copy link

@vercel vercel bot commented on a3f2494 May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.