From 74cd3ea604c776815538245f3678be8101eac427 Mon Sep 17 00:00:00 2001 From: Mohammad Kazem Khajeh Date: Sun, 10 Nov 2024 13:55:29 +0100 Subject: [PATCH] feat: create skeletons for component, create loading tsx --- .../(default)/rules/(main)/loading.tsx | 9 +++++++ src/components/rules/RuleCardListSkeleton.tsx | 14 +++++++++++ src/components/rules/RuleCardSkeleton.tsx | 24 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/app/[locale]/(default)/rules/(main)/loading.tsx create mode 100644 src/components/rules/RuleCardListSkeleton.tsx create mode 100644 src/components/rules/RuleCardSkeleton.tsx diff --git a/src/app/[locale]/(default)/rules/(main)/loading.tsx b/src/app/[locale]/(default)/rules/(main)/loading.tsx new file mode 100644 index 0000000..49b6223 --- /dev/null +++ b/src/app/[locale]/(default)/rules/(main)/loading.tsx @@ -0,0 +1,9 @@ +import { RuleCardListSkeleton } from '@/components/rules/RuleCardListSkeleton'; + +export default function RulesSkeleton() { + return ( + <> + + + ); +} diff --git a/src/components/rules/RuleCardListSkeleton.tsx b/src/components/rules/RuleCardListSkeleton.tsx new file mode 100644 index 0000000..61e90da --- /dev/null +++ b/src/components/rules/RuleCardListSkeleton.tsx @@ -0,0 +1,14 @@ +import { RuleCardSkeleton } from '@/components/rules/RuleCardSkeleton'; +import { useId } from 'react'; + +function RuleCardListSkeleton() { + return ( +
+ {Array.from({ length: 5 }).map(() => ( + + ))} +
+ ); +} + +export { RuleCardListSkeleton }; diff --git a/src/components/rules/RuleCardSkeleton.tsx b/src/components/rules/RuleCardSkeleton.tsx new file mode 100644 index 0000000..1091637 --- /dev/null +++ b/src/components/rules/RuleCardSkeleton.tsx @@ -0,0 +1,24 @@ +import { Button } from '@/components/ui/Button'; +import { Card, CardTitle } from '@/components/ui/Card'; +import { Skeleton } from '@/components/ui/Skeleton'; +import { cx } from '@/lib/utils'; + +function RuleCardSkeleton() { + return ( + + ); +} + +export { RuleCardSkeleton };