-
Notifications
You must be signed in to change notification settings - Fork 0
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
Facundo Martinez
authored and
Facundo Martinez
committed
Feb 15, 2021
1 parent
677d5fd
commit 1e9aab7
Showing
17 changed files
with
312 additions
and
71 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,21 +1,24 @@ | ||
.modalOverlay { | ||
position: fixed; | ||
top: 0; left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0,0,0,.3); | ||
} | ||
|
||
.modal { | ||
position: absolute; | ||
top: 50%; left: 50%; | ||
-webkit-transform: translate(-50%, -50%); | ||
-moz-transform: translate(-50%, -50%); | ||
transform: translate(-50%, -50%); | ||
background-color: white; | ||
width: 95%; | ||
padding: 2rem; | ||
max-width: 60rem; | ||
height: auto; | ||
min-height: 40.0rem; | ||
} | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
.modal { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
-webkit-transform: translate(-50%, -50%); | ||
-moz-transform: translate(-50%, -50%); | ||
transform: translate(-50%, -50%); | ||
background-color: white; | ||
width: 95%; | ||
padding: 2rem; | ||
max-width: 60rem; | ||
height: auto; | ||
min-height: 40rem; | ||
pointer-events: all; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React, { useEffect } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { | ||
fetchProductStart, | ||
setProduct, | ||
} from "./../../redux/Product/products.action"; | ||
import Button from "./../forms/Button"; | ||
import "./styles.scss"; | ||
|
||
const mapState = (state) => ({ | ||
product: state.productsData.product, | ||
}); | ||
|
||
const ProductCard = ({}) => { | ||
const dispatch = useDispatch(); | ||
const { productID } = useParams(); | ||
const { product } = useSelector(mapState); | ||
|
||
const { productThumbnail, productName, productPrice, productDesc } = product; | ||
|
||
useEffect(() => { | ||
dispatch(fetchProductStart(productID)); | ||
|
||
return () => { | ||
dispatch(setProduct({})); | ||
}; | ||
}, []); | ||
|
||
const configAddToCartBtn = { | ||
type: "button", | ||
}; | ||
|
||
return ( | ||
<div className="productCard"> | ||
<div className="hero"> | ||
<img src={productThumbnail} /> | ||
</div> | ||
<div className="productDetails"> | ||
<ul> | ||
<li> | ||
<h1>{productName}</h1> | ||
</li> | ||
<li> | ||
<span>${productPrice}</span> | ||
</li> | ||
<li> | ||
<div className="addToCart"> | ||
<Button {...configAddToCartBtn}>Add to cart</Button> | ||
</div> | ||
</li> | ||
<li> | ||
<span | ||
className="desc" | ||
dangerouslySetInnerHTML={{ __html: productDesc }} | ||
/> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductCard; |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.productCard { | ||
max-width: 80rem; | ||
margin: 0 auto 10rem; | ||
|
||
.hero { | ||
display: block; | ||
width: 100%; | ||
margin: 2rem auto; | ||
|
||
img { | ||
display: block; | ||
width: 100%; | ||
margin: 0; | ||
} | ||
} | ||
|
||
.productDetails { | ||
ul, | ||
ul li { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
ul li { | ||
list-style-type: none; | ||
margin: 0 auto 1rem; | ||
|
||
h1 { | ||
margin: 0; | ||
} | ||
} | ||
} | ||
|
||
.addToCart { | ||
max-width: 20rem; | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
import ProductCard from "../../components/ProductCard"; | ||
|
||
const ProductDetails = () => { | ||
return ( | ||
<div> | ||
<ProductCard /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductDetails; |
Oops, something went wrong.