From 8996a360dec012684d4d3a6c57bc05d4af181c49 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:38:07 +0100 Subject: [PATCH] refactor: updated news component names --- src/app/[locale]/(dashboard)/news/page.tsx | 8 ++++---- .../news/{NewsCard.tsx => ArticleCard.tsx} | 8 ++++---- .../news/{NewsItem.tsx => ArticleItem.tsx} | 8 ++++---- ...wsItemSkeleton.tsx => ArticleItemSkeleton.tsx} | 4 ++-- .../news/{NewsCardGrid.tsx => CardGrid.tsx} | 10 +++++----- ...sCardGridSuspense.tsx => CardGridSuspense.tsx} | 11 ++++------- .../news/{NewsItemGrid.tsx => ItemGrid.tsx} | 10 +++++----- ...sItemGridSuspense.tsx => ItemGridSuspense.tsx} | 15 ++++++--------- 8 files changed, 34 insertions(+), 40 deletions(-) rename src/components/news/{NewsCard.tsx => ArticleCard.tsx} (94%) rename src/components/news/{NewsItem.tsx => ArticleItem.tsx} (94%) rename src/components/news/{NewsItemSkeleton.tsx => ArticleItemSkeleton.tsx} (88%) rename src/components/news/{NewsCardGrid.tsx => CardGrid.tsx} (81%) rename src/components/news/{NewsCardGridSuspense.tsx => CardGridSuspense.tsx} (77%) rename src/components/news/{NewsItemGrid.tsx => ItemGrid.tsx} (87%) rename src/components/news/{NewsItemGridSuspense.tsx => ItemGridSuspense.tsx} (60%) diff --git a/src/app/[locale]/(dashboard)/news/page.tsx b/src/app/[locale]/(dashboard)/news/page.tsx index 7e69b78..aea6cb0 100644 --- a/src/app/[locale]/(dashboard)/news/page.tsx +++ b/src/app/[locale]/(dashboard)/news/page.tsx @@ -4,8 +4,8 @@ import { getTranslations, unstable_setRequestLocale } from 'next-intl/server'; import { Link } from '@/lib/navigation'; -import { NewsCardGridSuspense } from '@/components/news/NewsCardGridSuspense'; -import { NewsItemGridSuspense } from '@/components/news/NewsItemGridSuspense'; +import { CardGridSuspense } from '@/components/news/CardGridSuspense'; +import { ItemGridSuspense } from '@/components/news/ItemGridSuspense'; import { Button } from '@/components/ui/Button'; import { Separator } from '@/components/ui/Separator'; @@ -204,14 +204,14 @@ export default function News({ - -
@@ -14,4 +14,4 @@ function NewsItemSkeleton() { ); } -export { NewsItemSkeleton }; +export { ArticleItemSkeleton }; diff --git a/src/components/news/NewsCardGrid.tsx b/src/components/news/CardGrid.tsx similarity index 81% rename from src/components/news/NewsCardGrid.tsx rename to src/components/news/CardGrid.tsx index 385350b..35b6d2c 100644 --- a/src/components/news/NewsCardGrid.tsx +++ b/src/components/news/CardGrid.tsx @@ -1,8 +1,8 @@ import { cx } from '@/lib/utils'; -import { NewsCard } from '@/components/news/NewsCard'; +import { ArticleCard } from '@/components/news/ArticleCard'; -type NewsCardGridProps = { +type CardGridProps = { newsData: { id: number; internal: boolean; @@ -15,11 +15,11 @@ type NewsCardGridProps = { }; }; -function NewsCardGrid({ newsData, t }: NewsCardGridProps) { +function CardGrid({ newsData, t }: CardGridProps) { return (
{newsData.slice(0, 4).map((data, index) => ( - } > - + ); } -export { NewsCardGridSuspense }; +export { CardGridSuspense }; diff --git a/src/components/news/NewsItemGrid.tsx b/src/components/news/ItemGrid.tsx similarity index 87% rename from src/components/news/NewsItemGrid.tsx rename to src/components/news/ItemGrid.tsx index bb0926d..4818839 100644 --- a/src/components/news/NewsItemGrid.tsx +++ b/src/components/news/ItemGrid.tsx @@ -3,9 +3,9 @@ import { parseAsInteger, useQueryState } from 'nuqs'; import { PaginationCarousel } from '@/components/layout/PaginationCarousel'; -import { NewsItem } from '@/components/news/NewsItem'; +import { ArticleItem } from '@/components/news/ArticleItem'; -type NewsItemGridProps = { +type ItemGridProps = { newsData: { id: number; internal: boolean; @@ -24,7 +24,7 @@ type NewsItemGridProps = { }; }; -function NewsItemGrid({ newsData, t }: NewsItemGridProps) { +function ItemGrid({ newsData, t }: ItemGridProps) { const itemsDisplayedAsCards = 4; const itemsPerPage = 6; const [page, setPage] = useQueryState(t.page, parseAsInteger.withDefault(1)); @@ -41,7 +41,7 @@ function NewsItemGrid({ newsData, t }: NewsItemGridProps) { <>
{currentData.map((data) => ( -
{Array.from({ length: 6 }).map((_, index) => ( - + ))}
} > - + ); } -export { NewsItemGridSuspense }; +export { ItemGridSuspense };