Skip to content

Commit 79f901f

Browse files
committed
home skeleton improved
1 parent 05db567 commit 79f901f

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

client/src/components/Home.jsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { motion } from "framer-motion";
88
import "../App.css";
99
import WorthAlert from "./Worth/WorthAlert";
1010
import Skeleton from "./Skeletons/Skeleton";
11+
import HomeSkeleton from "./Skeletons/HomeSkeleton";
1112

1213
export default function Home() {
1314
const [showStats, setShowStats] = useState(false);
@@ -72,12 +73,16 @@ export default function Home() {
7273
<Navbar onSearch={handleSearch} />
7374
{
7475
loading ? (
75-
<div className="flex flex-wrap justify-center gap-4 items-center py-4 " >
76-
{
77-
Array.from({ length: 9 }, (_, index) => index + 1).map((item) => {
78-
return <Skeleton key={item} />
79-
})
80-
}
76+
<div className="flex flex-col mx-auto max-w-screen-xl px-2 sm:px-6 lg:px-8">
77+
<div className="grid grid-cols-1 gap-4 py-4 ">
78+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
79+
{
80+
Array.from({ length: 9 }, (_, index) => index + 1).map((item) => {
81+
return <HomeSkeleton key={item} />
82+
})
83+
}
84+
</div>
85+
</div>
8186
</div>
8287
)
8388
: (
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react'
2+
3+
const HomeSkeleton = () => {
4+
return (
5+
6+
<div className='flex justify-center items-center rounded-lg h-[280px] bg-[#292829]'>
7+
8+
<div className="flex flex-col gap-4 w-52">
9+
<div className="flex gap-4 items-center">
10+
<div className="skeleton w-16 h-16 rounded-full shrink-0"></div>
11+
<div className="flex flex-col gap-4">
12+
<div className="skeleton h-4 w-20"></div>
13+
<div className="skeleton h-4 w-28"></div>
14+
</div>
15+
</div>
16+
<div className="skeleton h-32 w-full"></div>
17+
</div>
18+
</div>
19+
20+
21+
)
22+
}
23+
24+
export default HomeSkeleton

0 commit comments

Comments
 (0)