diff --git a/components/Comment.js b/components/Comment.js index c75ff12f..4bae2665 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -1,10 +1,21 @@ import BLOG from '@/blog.config' import dynamic from 'next/dynamic' -import { useRouter } from 'next/router' import Tabs from '@/components/Tabs' -import { ReactCusdis } from 'react-cusdis' import { useGlobal } from '@/lib/global' -import { WalineComponent } from './WalineComponent' + +const WalineComponent = dynamic( + () => { + return import('@/components/WalineComponent') + }, + { ssr: false } +) + +const CusdisComponent = dynamic( + () => { + return import('@/components/CusdisComponent') + }, + { ssr: false } +) const GitalkComponent = dynamic( () => { @@ -33,9 +44,7 @@ const Comment = ({ frontMatter }) => { if (!frontMatter) { return <>Loading... } - const router = useRouter() - const { locale, isDarkMode } = useGlobal() - // const theme = isDarkMode ? 'dark' : 'light' + const { isDarkMode } = useGlobal() return (
@@ -56,16 +65,7 @@ const Comment = ({ frontMatter }) => { )} {BLOG.COMMENT_CUSDIS_APP_ID && (
- +
)} {BLOG.COMMENT_UTTERRANCES_REPO && (
@@ -73,18 +73,7 @@ const Comment = ({ frontMatter }) => {
)} {BLOG.COMMENT_GITALK_CLIENT_ID && (
- +
)}
diff --git a/components/CusdisComponent.js b/components/CusdisComponent.js new file mode 100644 index 00000000..f1fce6ef --- /dev/null +++ b/components/CusdisComponent.js @@ -0,0 +1,22 @@ +import { useGlobal } from '@/lib/global' +import { ReactCusdis } from 'react-cusdis' +import BLOG from '@/blog.config' +import { useRouter } from 'next/router' + +const CusdisComponent = ({ frontMatter }) => { + const { locale } = useGlobal() + const router = useRouter() + + return +} + +export default CusdisComponent diff --git a/components/Gitalk.js b/components/Gitalk.js index 2edc44bd..66b30174 100644 --- a/components/Gitalk.js +++ b/components/Gitalk.js @@ -1,9 +1,18 @@ import 'gitalk/dist/gitalk.css' - +import BLOG from '@/blog.config' import GitalkComponent from 'gitalk/dist/gitalk-component' -const Gitalk = props => { - return +const Gitalk = ({ frontMatter }) => { + return } export default Gitalk diff --git a/components/WalineComponent.js b/components/WalineComponent.js index 567dd1d9..80741b15 100644 --- a/components/WalineComponent.js +++ b/components/WalineComponent.js @@ -8,7 +8,7 @@ import { useRouter } from 'next/router' * @param {*} props * @returns */ -export const WalineComponent = (props) => { +const WalineComponent = (props) => { const walineInstanceRef = React.useRef(null) const containerRef = React.createRef() const router = useRouter() @@ -32,3 +32,5 @@ export const WalineComponent = (props) => { return
} + +export default WalineComponent