diff --git a/components/icons/CrossIcon.tsx b/components/icons/CrossIcon.tsx new file mode 100644 index 0000000..dde0123 --- /dev/null +++ b/components/icons/CrossIcon.tsx @@ -0,0 +1,10 @@ +import {Props} from '@/types' + +export function CrossIcon(props: Props) { + return ( + + ) +} \ No newline at end of file diff --git a/components/ui/Comments.tsx b/components/ui/Comments.tsx index d52e060..475d141 100644 --- a/components/ui/Comments.tsx +++ b/components/ui/Comments.tsx @@ -1,6 +1,6 @@ 'use client' -import React, {ReactNode, useActionState, useEffect, useState} from 'react' +import React, {useActionState, useEffect, useState} from 'react' import {useSession} from 'next-auth/react' import Image from 'next/image' import clsx from 'clsx' @@ -8,6 +8,7 @@ import {addComment, loginWithGitHub} from '@/app/actions/comments' import {Button} from '@/components/ui/Button' import {GitHubIcon} from '@/components/icons/SocialIcons' import {ArrowLeftIcon} from '@/components/icons/ArrowLeftIcon' +import {StatusMessage} from '@/components/ui/StatusMessage' import {getShortDurationFromNow} from '@/lib/dateFns' import ReplyProvider, {useReplyContext} from '@/app/context/ReplyProvider' import CommentFormProvider, {useCommentFormContext} from '@/app/context/CommentFormProvider' @@ -98,23 +99,6 @@ Comments.List = function List({comments}: CommentsListProps) { ) } -type CommentsStatusProps = { - children: ReactNode -} - -Comments.Status = function Status({children}: CommentsStatusProps) { - const errorConditions = ['error', 'problem'] - const isError = errorConditions.some(condition => children?.toString().toLowerCase().includes(condition)) - - return ( -
- {children} -
- ) -} - type InitialState = { message: string } @@ -130,6 +114,8 @@ Comments.Form = function Form({slug}: { slug: string }) { const replyContext = useReplyContext() const commentFormContext = useCommentFormContext() const commentFormRef = commentFormContext?.commentFormRef + const [commentLength, setCommentLength] = useState+ {children} +
+