Skip to content

Commit

Permalink
refactor: Content Skeleton Component
Browse files Browse the repository at this point in the history
  • Loading branch information
soomin9106 committed Jun 14, 2024
1 parent 2b08363 commit ce9716e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/common/components/ContentSkeleton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Skeleton } from "@shared/components/ui/skeleton";

export default function ContentSkeleton ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) {
return (
<Skeleton className={className} {...props} />
)
}
25 changes: 17 additions & 8 deletions src/workbook/components/WorkbookSkeleton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import { Skeleton } from "@shared/components/ui/skeleton";

import ContentSkeleton from "@common/components/ContentSkeleton";

export default function WorkbookSkeleton() {
const skeletonItems = new Array(6).fill(null);

return (
<div className="flex h-[100vh] w-full flex-col items-center overflow-x-hidden">
<Skeleton className="h-[338px] w-full" />

{/* Content Skeleton */}
<div className="w-full mt-[70px]">
<Skeleton className="h-[30px]" style={{ width: "60%" }}/>
<Skeleton className="h-[30px]" style={{ width: "80%", marginTop: "9px" }} />
<Skeleton className="h-[30px] w-full" style={{ marginTop: "9px" }} />
<Skeleton className="h-[30px] w-full" style={{ marginTop: "9px" }} />
<Skeleton className="h-[30px] w-full" style={{ marginTop: "9px" }} />
<Skeleton className="h-[30px] w-full" style={{ marginTop: "9px" }} />
<Skeleton className="h-[30px] w-full" style={{ marginTop: "9px" }} />
<div className="mt-[70px] w-full">
<ContentSkeleton className="h-[30px]" style={{ width: "60%" }} />
<ContentSkeleton
className="h-[30px]"
style={{ width: "80%", marginTop: "9px" }}
/>
{skeletonItems.map((_, index) => (
<ContentSkeleton
key={index}
className="h-[30px] w-full"
style={{ marginTop: "9px" }}
/>
))}
</div>
</div>
);
Expand Down

0 comments on commit ce9716e

Please sign in to comment.