diff --git a/src/App.jsx b/src/App.jsx index 3277cde..410e373 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,98 +1,7 @@ import styles from './App.module.scss' -import React from 'react' -/* HEADER ICONS */ -import CartIcon from './assets/icons/cart.svg' -import UserIcon from './assets/icons/user.svg' -import WishlistIcon from './assets/icons/wishlist.svg' -import LoopIcon from './assets/icons/loop.svg' - -/* PRODUCT CARD ICONS */ -import WishIcon from './assets/icons/wish.svg' - -const Header = () => { - return ( -
-

Exclusive

- -
- - -
-
- - - -
-
- ) -} - -const ProductCard = ({ name, price, imageUrl }) => { - return ( -
-
- -
- -
-
-
-

{name}

-
- ${price} -
-
-
- ) -} - -const ProductList = () => { - const [products, setProducts] = React.useState([]) - - const getProducts = async () => { - const response = await fetch('http://localhost:8000/products') - const data = await response.json() - setProducts(data) - } - - React.useEffect(() => { - getProducts() - }, []) - - return ( - - ) -} +import Header from './components/header' +import ProductList from './components/list' const App = () => { return ( diff --git a/src/components/card/index.jsx b/src/components/card/index.jsx index e69de29..f691e56 100644 --- a/src/components/card/index.jsx +++ b/src/components/card/index.jsx @@ -0,0 +1,26 @@ +import styles from './index.module.scss' + +import WishIcon from '../../assets/icons/wish.svg' + +const ProductCard = ({ name, price, imageUrl }) => { + return ( +
+
+ +
+ +
+
+
+

{name}

+
+ ${price} +
+
+
+ ) +} + +export default ProductCard diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index e69de29..277a326 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -0,0 +1,47 @@ +import styles from './index.module.scss' + +import CartIcon from '../../assets/icons/cart.svg' +import UserIcon from '../../assets/icons/user.svg' +import WishlistIcon from '../../assets/icons/wishlist.svg' +import LoopIcon from '../../assets/icons/loop.svg' + +const Header = () => { + return ( +
+

Exclusive

+ +
+ + +
+
+ + + +
+
+ ) +} + +export default Header diff --git a/src/components/list/index.jsx b/src/components/list/index.jsx index e69de29..e6db08e 100644 --- a/src/components/list/index.jsx +++ b/src/components/list/index.jsx @@ -0,0 +1,30 @@ +import React from 'react' +import styles from './index.module.scss' + +import ProductCard from '../card' + +const ProductList = () => { + const [products, setProducts] = React.useState([]) + + const getProducts = async () => { + const response = await fetch('http://localhost:8000/products') + const data = await response.json() + setProducts(data) + } + + React.useEffect(() => { + getProducts() + }, []) + + return ( + + ) +} + +export default ProductList