From 63bbf70bd67c02f36bde4a9c499bc8b4c445836a Mon Sep 17 00:00:00 2001 From: Ardeman Date: Thu, 20 Mar 2025 18:22:07 +0800 Subject: [PATCH] feat: improve loading state in CarouselHero and CategorySection with ImageSkeletonIcon --- app/components/ui/carousel-hero.tsx | 5 +--- app/components/ui/carousel-section.tsx | 1 - app/components/ui/category-section.tsx | 37 ++++++++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/components/ui/carousel-hero.tsx b/app/components/ui/carousel-hero.tsx index 4923028..99dd36f 100644 --- a/app/components/ui/carousel-hero.tsx +++ b/app/components/ui/carousel-hero.tsx @@ -77,10 +77,7 @@ export const CarouselHero = (properties: TNews) => {
+
diff --git a/app/components/ui/carousel-section.tsx b/app/components/ui/carousel-section.tsx index 0d645f7..829f0b7 100644 --- a/app/components/ui/carousel-section.tsx +++ b/app/components/ui/carousel-section.tsx @@ -85,7 +85,6 @@ export const CarouselSection = (properties: TNews) => { fallback={Array.from({ length: 3 }).map((_, index) => (
diff --git a/app/components/ui/category-section.tsx b/app/components/ui/category-section.tsx index d1e1353..1088833 100644 --- a/app/components/ui/category-section.tsx +++ b/app/components/ui/category-section.tsx @@ -6,6 +6,7 @@ import { twMerge } from 'tailwind-merge' import { ErrorAwait } from '~/components/error/await' import { CarouselNextIcon } from '~/components/icons/carousel-next' import { CarouselPreviousIcon } from '~/components/icons/carousel-previous' +import { ImageSkeletonIcon } from '~/components/icons/image-skeleton' import { Button } from '~/components/ui/button' import { useNewsContext } from '~/contexts/news' import type { loader } from '~/routes/_news' @@ -43,7 +44,31 @@ export const CategorySection = (properties: TNews) => {
- Loading...
}> + ( +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading... +
+ ))} + > } @@ -56,18 +81,14 @@ export const CategorySection = (properties: TNews) => { ) => (
{title} -
+