From ab5b545625e8712d1c24c6002e26ffd5f0094125 Mon Sep 17 00:00:00 2001 From: Ardeman Date: Thu, 20 Mar 2025 17:44:04 +0800 Subject: [PATCH] feat: add ImageSkeletonIcon for loading state in carousel section --- app/components/icons/image-skeleton.tsx | 19 ++++++ app/components/ui/carousel-section.tsx | 88 ++++++++++++++++--------- 2 files changed, 75 insertions(+), 32 deletions(-) create mode 100644 app/components/icons/image-skeleton.tsx diff --git a/app/components/icons/image-skeleton.tsx b/app/components/icons/image-skeleton.tsx new file mode 100644 index 0000000..a14665f --- /dev/null +++ b/app/components/icons/image-skeleton.tsx @@ -0,0 +1,19 @@ +import type { JSX, SVGProps } from 'react' + +export const ImageSkeletonIcon = ( + properties: JSX.IntrinsicAttributes & SVGProps, +) => { + return ( + + ) +} diff --git a/app/components/ui/carousel-section.tsx b/app/components/ui/carousel-section.tsx index a5c5a1c..0d645f7 100644 --- a/app/components/ui/carousel-section.tsx +++ b/app/components/ui/carousel-section.tsx @@ -4,6 +4,7 @@ import { Await, useRouteLoaderData } from 'react-router' import { stripHtml } from 'string-strip-html' import { ErrorAwait } from '~/components/error/await' +import { ImageSkeletonIcon } from '~/components/icons/image-skeleton' import { CarouselButton } from '~/components/ui/button-slide' import { useNewsContext } from '~/contexts/news' import type { loader } from '~/routes/_news' @@ -80,7 +81,32 @@ export const CarouselSection = (properties: TNews) => { ref={emblaReference} >
- Loading...
}> + ( +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading... +
+ ))} + > } @@ -92,40 +118,38 @@ export const CarouselSection = (properties: TNews) => { index, ) => (
-
- {title} -
-
- -

- {title} -

-
-

- {stripHtml(content).result} -

- + {title} +
+
+ +

+ {title} +

+

+ {stripHtml(content).result} +

+
),