diff --git a/themes/heo/components/HexoRecentComments.js b/themes/heo/components/HexoRecentComments.js index dbeee596..354e2182 100644 --- a/themes/heo/components/HexoRecentComments.js +++ b/themes/heo/components/HexoRecentComments.js @@ -1,16 +1,15 @@ -import Card from '@/themes/hexo/components/Card' -import { useGlobal } from '@/lib/global' -import Link from 'next/link' -import { RecentComments } from '@waline/client' -import { useEffect, useState } from 'react' import { siteConfig } from '@/lib/config' +import { useGlobal } from '@/lib/global' +import { RecentComments } from '@waline/client' +import Link from 'next/link' +import { useEffect, useState } from 'react' /** * @see https://waline.js.org/guide/get-started.html * @param {*} props * @returns */ -const HexoRecentComments = (props) => { +const HexoRecentComments = props => { const [comments, updateComments] = useState([]) const { locale } = useGlobal() const [onLoading, changeLoading] = useState(true) @@ -25,22 +24,43 @@ const HexoRecentComments = (props) => { }, []) return ( - -
- - {locale.COMMON.RECENT_COMMENTS} +
+
+ + {locale.COMMON.RECENT_COMMENTS} +
+ + {onLoading && ( +
+ Loading... + +
+ )} + {!onLoading && comments && comments.length === 0 && ( +
No Comments
+ )} + {!onLoading && + comments && + comments.length > 0 && + comments.map(comment => ( +
+
+
+ + --{comment.nick} +
- - {onLoading &&
Loading...
} - {!onLoading && comments && comments.length === 0 &&
No Comments
} - {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
-
-
- --{comment.nick} -
-
)} - - +
+ ))} +
) }