Skip to content

Commit 589280b

Browse files
committed
feat: Added Shimmer UI
1 parent 35dedca commit 589280b

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Skeleton } from "@/components/ui/skeleton";
2+
3+
const LoadingProblems = () => {
4+
5+
const numbers = Array.from({ length: 10 }, (_, i) => i + 1);
6+
return (
7+
<div className="flex flex-col w-full justify-center items-center gap-3">
8+
{numbers.map((number) => {
9+
return (
10+
<Skeleton key={number} className="w-full h-10 rounded-xl bg-muted-foreground" />
11+
12+
)
13+
})}
14+
</div>
15+
)
16+
}
17+
18+
export default LoadingProblems
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { cn } from "@/lib/utils"
2+
3+
function Skeleton({
4+
className,
5+
...props
6+
}: React.HTMLAttributes<HTMLDivElement>) {
7+
return (
8+
<div
9+
className={cn("animate-pulse rounded-md bg-muted", className)}
10+
{...props}
11+
/>
12+
)
13+
}
14+
15+
export { Skeleton }

frontend/src/pages/ProblemSet.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { Search } from "lucide-react";
2929
import { useNavigate } from "react-router-dom";
3030

3131
import { ServerError } from "./Error/ServerError";
32+
import LoadingProblems from "@/components/core/problem/LoadingProblems";
3233

3334

3435

@@ -94,6 +95,7 @@ const ProblemSet = () => {
9495
setFocus(false);
9596
}
9697

98+
9799
if (error) {
98100
return <ServerError />
99101
}
@@ -119,12 +121,11 @@ const ProblemSet = () => {
119121
<Search className={`bg-white h-8 w-10 p-2 rounded-r-md text-black justify-center cursor-pointer hover:bg-gray-100 border-l-ring ${focus ? `ring-2 ring-offset-2 ring-black` : `outline-none`}`} />
120122

121123
</div>
122-
<div className="mt-2 relative border border-gray-700 rounded-lg">
124+
<div className="mt-2 relative border-gray-700 rounded-lg">
123125
{loading ? (
124-
<div className="absolute flex items-center justify-center text-white inset-0 h-8 text-bold">
125-
<div className="loader">Loading...</div>
126-
<img src="" alt="" />
127-
</div>
126+
<>
127+
<LoadingProblems />
128+
</>
128129
) : (
129130
<Table className="text-white">
130131
<TableHeader>

0 commit comments

Comments
 (0)