Skip to content

Commit

Permalink
center loading on screen after remove it from the component
Browse files Browse the repository at this point in the history
  • Loading branch information
No0ne003 committed May 17, 2024
1 parent a802095 commit 6c5a100
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/pages/CustomHooks/use-fetch/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const UseFetchHookTest = () => {
<span className="text-primary font-bold">useFetch</span> Hook
</h1>
{pending ? (
<Loading />
<div className="absolute inset-0 m-auto flex justify-center items-center">
<Loading />
</div>
) : error ? (
<h3 className="text-rose-500 text-lg text-center">{error}</h3>
) : data && data.products && data.products.length ? (
Expand Down
4 changes: 3 additions & 1 deletion src/pages/GithubProfileFinder/GithubProfileFinder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const GithubProfileFinder = () => {
</Button>
</div>
{loading ? (
<Loading />
<div className="absolute flex justify-center items-center m-auto inset-0">
<Loading />
</div>
) : userData !== null ? (
<div className="my-24">
<User user={userData} />
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ImageSlider.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { BsArrowLeftCircleFill, BsArrowRightCircleFill } from "react-icons/bs";
import Loading from "@/components/ui/Loading";

function ImageSlider({
url = "https://meme-api.com/gimme",
Expand Down Expand Up @@ -34,7 +35,7 @@ function ImageSlider({
}, [url]);

if (loading) {
return <div>Loading data ! please wait</div>;
return <div className="absolute inset-0 m-auto flex justify-center items-center"><Loading /></div>;
}
if (errorMsg !== null) {
return <div>Error occured ! {errorMsg}</div>;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LoadMoreData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function LoadMoreData() {
}, [products]);

if (loading) {
return <Loading />
return <div className="absolute inset-0 m-auto flex justify-center items-center"><Loading /></div>
}
console.log(products);

Expand Down
4 changes: 3 additions & 1 deletion src/pages/SearchAutoComplete/SearchAutoComplete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ const SearchAutoComplete = () => {
placeholder="Search Users Here..."
/>
{loading ? (
<Loading />
<div className="absolute inset-0 m-auto flex justify-center items-center">
<Loading />
</div>
) : (
showDropDown && (
<Suggesstions handleClick={handleClick} data={filteredUsers} />
Expand Down

0 comments on commit 6c5a100

Please sign in to comment.