{comment.user.name}
-- -
-{comment.content}
-diff --git a/components/ui/Comments.tsx b/components/ui/Comments.tsx
index 5c5a201..cc372f8 100644
--- a/components/ui/Comments.tsx
+++ b/components/ui/Comments.tsx
@@ -1,6 +1,6 @@
'use client'
-import React, {useActionState} from 'react'
+import React, {ReactNode, useActionState} from 'react'
import {useSession} from 'next-auth/react'
import Image from 'next/image'
import useSWR from 'swr'
@@ -27,36 +27,51 @@ type CommentsListProps = {
}
Comments.List = function List({comments}: CommentsListProps) {
+ if (!(comments?.length > 0)) return null
+
return (
{comment.user.name}
-
- {comment.content} {comment.user.name}
+
+ {comment.content}
- {comments?.length > 0 ? 'Comments' : 'No comments yet'}
+ Comments
- {comments &&
- <>
- {comments.map((comment) => (
-
+ {children} +
+ ) +} + type InitialState = { message: string } @@ -103,12 +118,10 @@ Comments.Form = function Form({slug}: CommentsProps) { /> -+