diff --git a/app/loading.tsx b/app/loading.tsx new file mode 100644 index 0000000..48afb7e --- /dev/null +++ b/app/loading.tsx @@ -0,0 +1,9 @@ +import { ArrowPathIcon } from "@heroicons/react/24/outline"; + +export default function Loading() { + return ( +
+ +
+ ); +} diff --git a/app/reviews/[slug]/page.tsx b/app/reviews/[slug]/page.tsx index 90b9491..6d2c4b9 100644 --- a/app/reviews/[slug]/page.tsx +++ b/app/reviews/[slug]/page.tsx @@ -6,6 +6,8 @@ import { notFound } from "next/navigation"; import CommentList from "@/components/CommentList"; import CommentForm from "@/components/CommentForm"; import { ChatBubbleBottomCenterTextIcon } from "@heroicons/react/24/outline"; +import { Suspense } from "react"; +import CommentListSkeleton from "@/components/CommentListSekeleton"; interface ReviewPageParams { slug: string; @@ -65,7 +67,9 @@ const ReviewPage = async ({ params: { slug } }: ReviewPageProps) => { Comments - + }> + + ); diff --git a/components/CommentListSekeleton.tsx b/components/CommentListSekeleton.tsx new file mode 100644 index 0000000..e947849 --- /dev/null +++ b/components/CommentListSekeleton.tsx @@ -0,0 +1,22 @@ +import { UserCircleIcon } from "@heroicons/react/24/outline"; + +export default function CommentListSkeleton() { + return ( + + ); +} diff --git a/lib/reviews.ts b/lib/reviews.ts index 856a680..b59a083 100644 --- a/lib/reviews.ts +++ b/lib/reviews.ts @@ -1,4 +1,4 @@ -import "server-only"; //checks if all requests are made form the server components +import "server-only"; import { marked } from "marked"; import qs from "qs";