diff --git a/themes/example/components/ExampleRecentComments.js b/themes/example/components/ExampleRecentComments.js
new file mode 100644
index 00000000..5447b7cc
--- /dev/null
+++ b/themes/example/components/ExampleRecentComments.js
@@ -0,0 +1,35 @@
+import React from 'react'
+import { RecentComments } from '@waline/client'
+import BLOG from '@/blog.config'
+import Link from 'next/link'
+
+/**
+ * @see https://waline.js.org/guide/get-started.html
+ * @param {*} props
+ * @returns
+ */
+const ExampleRecentComments = (props) => {
+ const [comments, updateComments] = React.useState([])
+ const [onLoading, changeLoading] = React.useState(true)
+ React.useEffect(() => {
+ RecentComments({
+ serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
+ count: 5
+ }).then(({ comments }) => {
+ changeLoading(false)
+ updateComments(comments)
+ })
+ }, [])
+
+ return <>
+ {onLoading &&
Loading...
}
+ {!onLoading && comments && comments.length === 0 && Loading...
}
{!onLoading && comments && comments.length === 0 &&
+ {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
)}
diff --git a/themes/next/components/NextRecentComments.js b/themes/next/components/NextRecentComments.js
new file mode 100644
index 00000000..caa84ef2
--- /dev/null
+++ b/themes/next/components/NextRecentComments.js
@@ -0,0 +1,35 @@
+import React from 'react'
+import { RecentComments } from '@waline/client'
+import BLOG from '@/blog.config'
+import Link from 'next/link'
+
+/**
+ * @see https://waline.js.org/guide/get-started.html
+ * @param {*} props
+ * @returns
+ */
+const NextRecentComments = (props) => {
+ const [comments, updateComments] = React.useState([])
+ const [onLoading, changeLoading] = React.useState(true)
+ React.useEffect(() => {
+ RecentComments({
+ serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
+ count: 5
+ }).then(({ comments }) => {
+ changeLoading(false)
+ updateComments(comments)
+ })
+ }, [])
+
+ return <>
+ {onLoading &&
Loading...
}
+ {!onLoading && comments && comments.length === 0 &&
No Comments
}
+ {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
)}
+
+ >
+}
+
+export default NextRecentComments
diff --git a/themes/next/components/SideAreaRight.js b/themes/next/components/SideAreaRight.js
index b4f03826..78f2e202 100644
--- a/themes/next/components/SideAreaRight.js
+++ b/themes/next/components/SideAreaRight.js
@@ -6,6 +6,8 @@ import CategoryGroup from './CategoryGroup'
import TagGroups from './TagGroups'
import CONFIG_NEXT from '../config_next'
import { useRouter } from 'next/router'
+import NextRecentComments from './NextRecentComments'
+import BLOG from '@/blog.config'
/**
* 侧边平铺
@@ -77,6 +79,24 @@ const SideAreaRight = (props) => {
)}
+ {BLOG.COMMENT_WALINE_SERVER_URL &&
+
+
+
+
+ }
+
)