Skip to content

Commit aab85a0

Browse files
Update skeleton components in dashboard page
1 parent bdc3076 commit aab85a0

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

app/dashboard/(overview)/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
InvoiceSkeleton,
99
RevenueChartSkeleton,
1010
CardSkeleton,
11+
InvoicesSkeleton,
12+
CardsSkeleton,
1113
} from '@/app/ui/skeletons';
1214

1315
export default async function Page() {
@@ -17,15 +19,15 @@ export default async function Page() {
1719
Dashboard
1820
</h1>
1921
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
20-
<Suspense fallback={<CardSkeleton />}>
22+
<Suspense fallback={<CardsSkeleton />}>
2123
<CardWrapper />
2224
</Suspense>
2325
</div>
2426
<div className="mt-6 grid grid-cols-1 gap-6 md:grid-cols-4 lg:grid-cols-8">
2527
<Suspense fallback={<RevenueChartSkeleton />}>
2628
<RevenueChart />
2729
</Suspense>
28-
<Suspense fallback={<InvoiceSkeleton />}>
30+
<Suspense fallback={<InvoicesSkeleton />}>
2931
<LatestInvoices />
3032
</Suspense>
3133
</div>

app/ui/skeletons.tsx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ export function InvoiceSkeleton() {
5959
);
6060
}
6161

62+
export function InvoicesSkeleton() {
63+
return (
64+
<div className="flex w-full flex-col md:col-span-4">
65+
<div className="mb-4 h-8 w-36 rounded-md bg-gray-100" />
66+
<div
67+
className={`${shimmer} relative w-full overflow-hidden md:col-span-4`}
68+
>
69+
<div className="flex grow flex-col justify-between rounded-xl bg-gray-50 p-4">
70+
<div className="bg-white px-6">
71+
<InvoiceSkeleton />
72+
<InvoiceSkeleton />
73+
<InvoiceSkeleton />
74+
<InvoiceSkeleton />
75+
<InvoiceSkeleton />
76+
<div className="flex items-center bg-gray-200 pb-2 pt-6">
77+
<div className="h-5 w-5 rounded-full bg-gray-200" />
78+
<div className="ml-2 h-4 w-20 rounded-md bg-gray-200" />
79+
</div>
80+
</div>
81+
</div>
82+
</div>
83+
</div>
84+
);
85+
}
86+
6287
export function LatestInvoicesSkeleton() {
6388
return (
6489
<div
@@ -67,11 +92,6 @@ export function LatestInvoicesSkeleton() {
6792
<div className="mb-4 h-8 w-36 rounded-md bg-gray-100" />
6893
<div className="flex grow flex-col justify-between rounded-xl bg-gray-100 p-4">
6994
<div className="bg-white px-6">
70-
<InvoiceSkeleton />
71-
<InvoiceSkeleton />
72-
<InvoiceSkeleton />
73-
<InvoiceSkeleton />
74-
<InvoiceSkeleton />
7595
<div className="flex items-center pb-2 pt-6">
7696
<div className="h-5 w-5 rounded-full bg-gray-200" />
7797
<div className="ml-2 h-4 w-20 rounded-md bg-gray-200" />
@@ -89,10 +109,7 @@ export default function DashboardSkeleton() {
89109
className={`${shimmer} relative mb-4 h-8 w-36 overflow-hidden rounded-md bg-gray-100`}
90110
/>
91111
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
92-
<CardSkeleton />
93-
<CardSkeleton />
94-
<CardSkeleton />
95-
<CardSkeleton />
112+
<CardsSkeleton />
96113
</div>
97114
<div className="mt-6 grid grid-cols-1 gap-6 md:grid-cols-4 lg:grid-cols-8">
98115
<RevenueChartSkeleton />

0 commit comments

Comments
 (0)