-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fa27e8
commit f98b0c7
Showing
1 changed file
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
import ProductList from './ProductList'; | ||
import FilterContainer from './FilterContainer'; | ||
|
||
import CartIcon from './CartIcon'; | ||
|
||
import { EcommerceProvider } from './ecommerContext'; | ||
import Spinner from './Spinner'; | ||
import { EcommerceProvider, useEcommerceContext } from './ecommerContext'; | ||
import Cart from './Cart'; | ||
|
||
const Ecommerce = () => { | ||
return ( | ||
<EcommerceProvider> | ||
<section className="w-full px-6 py-4 bg-gray-100 relative"> | ||
<div className="flex justify-between items-center"> | ||
<h1 className="flex-1 text-xl tracking-widest font-bold text-slate-900 text-center my-6"> | ||
Win Store | ||
</h1> | ||
<CartIcon /> | ||
</div> | ||
<div> | ||
<FilterContainer /> | ||
<ProductList /> | ||
</div> | ||
<Cart /> | ||
</section> | ||
<Content /> | ||
</EcommerceProvider> | ||
); | ||
}; | ||
|
||
const Content = () => { | ||
const { isLoading } = useEcommerceContext(); | ||
if (isLoading) { | ||
return ( | ||
<div className="bg-gray-100 py-6 h-screen"> | ||
<Spinner /> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<section className="w-full px-6 py-4 bg-gray-100 relative"> | ||
<div className="flex justify-between items-center"> | ||
<h1 className="flex-1 text-xl tracking-widest font-bold text-slate-900 text-center my-6"> | ||
Win Store | ||
</h1> | ||
<CartIcon /> | ||
</div> | ||
<div> | ||
<FilterContainer /> | ||
<ProductList /> | ||
</div> | ||
<Cart /> | ||
</section> | ||
); | ||
}; | ||
|
||
export default Ecommerce; |