Skip to content

Commit fdef72c

Browse files
committed
loading added
1 parent 1d8496c commit fdef72c

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

public/assets/bird.gif

493 KB
Loading

public/assets/man.gif

145 KB
Loading

public/assets/run.gif

24.3 KB
Loading

src/components/Contributors/contributors.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ function Contribute() {
77
const userURL = "https://api.github.com/users/";
88
const url = "https://api.github.com/repos/devvsakib/github-error-solve/contributors"
99
const [data, setData] = useState([]);
10+
const [loading, setLoading] = useState(true);
1011
useEffect(() => {
12+
setLoading(false)
1113
const fetchUsers = async (url) => {
1214
const response = await fetch(url);
1315
const users = await response.json();
1416
setData(users)
17+
setLoading(true)
1518
}
1619
fetchUsers(url)
1720
}, [data.length])
@@ -29,7 +32,7 @@ function Contribute() {
2932
{
3033
// User filtered by CONTRIBUTIONS number, contribute more to jump in first place
3134

32-
data.map(user =>
35+
loading ? (data.map(user =>
3336
<div
3437
id="container"
3538
className={`py-4 mb-4 col-span-12 md:col-span-6 xl:col-span-4 md:px-6 border-l-4 rounded-lg bg-dark-secondary flex flex-col mt-8 items-center mx-auto gap-2 px-3 border-[#${changeColor()}] hover:border-primary hover:text-primary`}>
@@ -42,6 +45,12 @@ function Contribute() {
4245
</div>
4346
</div>
4447
)
48+
) : (
49+
<div>
50+
<img src="public/assets/run.gif" alt="" />
51+
<h1 className='text-center text-2xl text-white'>Something is Wrong</h1>
52+
</div>
53+
)
4554
}
4655
</section>
4756
</Layout>

0 commit comments

Comments
 (0)