Skip to content

Commit

Permalink
feat: module card skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Jul 29, 2024
1 parent 227de78 commit 9e1b09a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
11 changes: 11 additions & 0 deletions src/app/(dashboard)/app/_components/module-card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { convertHexToRGBA } from '@/lib/colors';
import { Icon, type IconNames } from '@/primitives/icon';
import { Skeleton } from '@/primitives/skeleton';
import Link from 'next/link';
import colors, { zinc } from 'tailwindcss/colors';

Expand Down Expand Up @@ -41,3 +42,13 @@ export function ModuleCard({
</li>
);
}

ModuleCard.Skeleton = function ModuleCardSkeleton() {
return (
<div className="flex h-[138px] w-[250px] flex-col gap-2 rounded-xl border border-gray-element bg-gray-subtle p-6">
<Skeleton className="size-5" />
<Skeleton className="mt-2 h-6 w-[200px]" />
<Skeleton className="mt-1 h-4 w-[50px]" />
</div>
);
};
1 change: 1 addition & 0 deletions src/app/(dashboard)/app/_components/recent-modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function RecentModules() {
icon="Airplay"
name="Information Security"
/>
<ModuleCard.Skeleton />
</ul>
<ScrollBar orientation="horizontal" />
</ScrollArea>
Expand Down
15 changes: 15 additions & 0 deletions src/primitives/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { cn } from '@/lib/utils';

function Skeleton({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn('animate-pulse rounded-md bg-gray-element', className)}
{...props}
/>
);
}

export { Skeleton };

0 comments on commit 9e1b09a

Please sign in to comment.