diff --git a/src/app/(pages)/home/page.tsx b/src/app/(pages)/home/page.tsx index eddb651..edbb635 100644 --- a/src/app/(pages)/home/page.tsx +++ b/src/app/(pages)/home/page.tsx @@ -2,18 +2,46 @@ import { getArticlesPaginated } from '@/lib/feature/article/article.external'; import { ArticleCard } from '@/ui/components/internal/article-card'; import { ArticleListPagination } from '@/ui/components/internal/article-list-pagination'; import { FileTextIcon } from 'lucide-react'; +import { Suspense } from 'react'; const PAGE_SIZE = 9; -type HomeProps = { - searchParams: Promise<{ page?: string; pageSize?: string }>; -}; +const ArticleCardSkeleton = () => ( +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+); -const Home = async ({ searchParams }: HomeProps) => { - const { page: pageParam, pageSize: pageSizeParam } = await searchParams; - const page = Math.max(1, Number(pageParam) || 1); - const pageSize = Number(pageSizeParam) || PAGE_SIZE; +const ArticleListSkeleton = () => ( + <> +
+
+ {Array.from({ length: PAGE_SIZE }).map((_, i) => ( + + ))} +
+ +); +interface ArticleListProps { + page: number; + pageSize: number; +} + +const ArticleList = async ({ page, pageSize }: ArticleListProps) => { const { data: articles, totalPages, @@ -21,20 +49,12 @@ const Home = async ({ searchParams }: HomeProps) => { } = await getArticlesPaginated(page, pageSize); return ( -
-
-

- Dev Blog -

-

- Latest Articles -

-

- {total === 0 - ? 'No articles published yet.' - : `${total} article${total === 1 ? '' : 's'} published`} -

-
+ <> +

+ {total === 0 + ? 'No articles published yet.' + : `${total} article${total === 1 ? '' : 's'} published`} +

{articles.length === 0 ? (
@@ -65,6 +85,32 @@ const Home = async ({ searchParams }: HomeProps) => { />
)} + + ); +}; + +type HomeProps = { + searchParams: Promise<{ page?: string; pageSize?: string }>; +}; + +const Home = async ({ searchParams }: HomeProps) => { + const { page: pageParam, pageSize: pageSizeParam } = await searchParams; + const page = Math.max(1, Number(pageParam) || 1); + const pageSize = Number(pageSizeParam) || PAGE_SIZE; + + return ( +
+
+

+ Dev Blog +

+

+ Latest Articles +

+
+ }> + +
); };