Product detail modal
This commit is contained in:
@ -6,20 +6,21 @@ import Typography from "@mui/material/Typography";
|
||||
import { CardActionArea } from "@mui/material";
|
||||
import { PRODUCT_IMAGE_DIR } from "../const";
|
||||
|
||||
function ProductCard({ product }) {
|
||||
const productImg = `${PRODUCT_IMAGE_DIR}${product.image}`;
|
||||
function ProductCard({ product, onClick }) {
|
||||
const productImg = `${PRODUCT_IMAGE_DIR}/${product.image}`;
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardActionArea>
|
||||
<CardMedia component="img" height="140" image={productImg} alt={product.name} />
|
||||
<Card sx={{ width: "100%" }}>
|
||||
<CardActionArea
|
||||
onClick={() => {
|
||||
onClick(product.id);
|
||||
}}
|
||||
>
|
||||
<CardMedia component="img" height="200" image={productImg} alt={product.name} />
|
||||
<CardContent>
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
<Typography gutterBottom variant="h5" component="div" sx={{ marginBottom: 0 }}>
|
||||
{product.name}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{product.description}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user