Skip to content

Commit

Permalink
💄 Improvements to page skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella committed Jan 13, 2024
1 parent 0a2e3e3 commit 3305739
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
8 changes: 4 additions & 4 deletions apps/web/src/app/[locale]/invite/[urlId]/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PageContent,
PageHeader,
} from "@/app/components/page-layout";
import { Skeleton } from "@/components/skeleton";
import { Skeleton, SkeletonCard } from "@/components/skeleton";

export default function Loading() {
return (
Expand All @@ -13,10 +13,10 @@ export default function Loading() {
</PageHeader>
<PageContent>
<div className="max-w-4xl mx-auto space-y-6">
<Skeleton className="h-72 w-full" />
<Skeleton className="h-96 w-full" />
<SkeletonCard className="h-72 w-full" />
<SkeletonCard className="h-96 w-full" />
<hr />
<Skeleton className="h-64 w-full" />
<SkeletonCard className="h-64 w-full" />
</div>
</PageContent>
</PageContainer>
Expand Down
13 changes: 7 additions & 6 deletions apps/web/src/app/[locale]/poll/[urlId]/skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ import {
PageContent,
PageHeader,
} from "@/app/components/page-layout";
import { Skeleton } from "@/components/skeleton";
import { Skeleton, SkeletonCard } from "@/components/skeleton";

export default function Loading() {
return (
<PageContainer>
<PageHeader>
<Skeleton className="w-32 h-9" />
<PageHeader className="flex items-center gap-x-4">
<Skeleton className="w-9 h-9" />
<Skeleton className="w-48 h-5" />
</PageHeader>
<PageContent>
<div className="max-w-4xl mx-auto space-y-6">
<Skeleton className="h-72 w-full" />
<Skeleton className="h-96 w-full" />
<SkeletonCard className="h-72 w-full" />
<SkeletonCard className="h-96 w-full" />
<hr />
<Skeleton className="h-64 w-full" />
<SkeletonCard className="h-64 w-full" />
</div>
</PageContent>
</PageContainer>
Expand Down
25 changes: 20 additions & 5 deletions apps/web/src/components/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
import clsx from "clsx";
import { cn } from "@rallly/ui";
import React from "react";

import { PropsWithClassName } from "@/types";

export const Skeleton = (props: PropsWithClassName) => {
export const Skeleton = (props: {
className?: string;
children?: React.ReactNode;
}) => {
return (
<div
className={clsx("animate-pulse rounded-md bg-gray-200", props.className)}
className={cn("animate-pulse rounded-md bg-gray-200", props.className)}
>
{props.children}
</div>
);
};

export function SkeletonCard({
children,
className,
}: {
children?: React.ReactNode;
className?: string;
}) {
return (
<div className={cn("rounded-md bg-white shadow-sm", className)}>
{children}
</div>
);
}

1 comment on commit 3305739

@vercel
Copy link

@vercel vercel bot commented on 3305739 Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app-rallly.vercel.app
app-git-main-rallly.vercel.app
app.rallly.co

Please sign in to comment.