mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-17 15:09:31 +00:00
减少非必要package
This commit is contained in:
@@ -17,7 +17,6 @@ const Fireworks = () => {
|
||||
useEffect(() => {
|
||||
// 异步加载
|
||||
async function loadFireworks() {
|
||||
console.log('加载烟花')
|
||||
loadExternalResource(
|
||||
'https://cdn.bootcdn.net/ajax/libs/animejs/3.2.1/anime.min.js',
|
||||
'js'
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import Giscus from '@giscus/react'
|
||||
import { loadExternalResource } from '@/lib/utils'
|
||||
import { useEffect } from 'react'
|
||||
// import Giscus from '@giscus/react'
|
||||
|
||||
/**
|
||||
* Giscus评论 @see https://giscus.app/zh-CN
|
||||
@@ -12,21 +14,34 @@ import Giscus from '@giscus/react'
|
||||
const GiscusComponent = () => {
|
||||
const { isDarkMode } = useGlobal()
|
||||
const theme = isDarkMode ? 'dark' : 'light'
|
||||
useEffect(() => {
|
||||
loadExternalResource('/js/giscus.js', 'js').then(() => {
|
||||
if (window.Giscus) {
|
||||
window.Giscus.init('#giscus')
|
||||
}
|
||||
})
|
||||
return () => {
|
||||
window.Giscus.destroy()
|
||||
}
|
||||
}, [isDarkMode])
|
||||
|
||||
return (
|
||||
<Giscus
|
||||
repo={siteConfig('COMMENT_GISCUS_REPO')}
|
||||
repoId={siteConfig('COMMENT_GISCUS_REPO_ID')}
|
||||
categoryId={siteConfig('COMMENT_GISCUS_CATEGORY_ID')}
|
||||
mapping={siteConfig('COMMENT_GISCUS_MAPPING')}
|
||||
reactionsEnabled={siteConfig('COMMENT_GISCUS_REACTIONS_ENABLED')}
|
||||
emitMetadata={siteConfig('COMMENT_GISCUS_EMIT_METADATA')}
|
||||
theme={theme}
|
||||
inputPosition={siteConfig('COMMENT_GISCUS_INPUT_POSITION')}
|
||||
lang={siteConfig('COMMENT_GISCUS_LANG')}
|
||||
loading={siteConfig('COMMENT_GISCUS_LOADING')}
|
||||
crossorigin={siteConfig('COMMENT_GISCUS_CROSSORIGIN')}
|
||||
/>
|
||||
<div
|
||||
id='giscus'
|
||||
data-repo={siteConfig('COMMENT_GISCUS_REPO')}
|
||||
data-repo-id={siteConfig('COMMENT_GISCUS_REPO_ID')}
|
||||
// data-category='{{ $.Site.Params.giscus.dataCategory }}'
|
||||
data-category-id={siteConfig('COMMENT_GISCUS_CATEGORY_ID')}
|
||||
data-mapping={siteConfig('COMMENT_GISCUS_MAPPING')}
|
||||
// data-strict='0'
|
||||
data-reactions-enabled={siteConfig('COMMENT_GISCUS_REACTIONS_ENABLED')}
|
||||
data-emit-metadata={siteConfig('COMMENT_GISCUS_EMIT_METADATA')}
|
||||
data-input-position={siteConfig('COMMENT_GISCUS_INPUT_POSITION')}
|
||||
data-theme={theme}
|
||||
data-lang={siteConfig('COMMENT_GISCUS_LANG')}
|
||||
data-loading={siteConfig('COMMENT_GISCUS_LOADING')}
|
||||
// crossorigin={siteConfig('COMMENT_GISCUS_CROSSORIGIN')}
|
||||
></div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user