Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
padding: 1rem;
border: 2px green double;
transition: box-shadow .3s ease-in-out;
cursor: pointer;

&:hover {
box-shadow: 8px 10px 5px 2px #14763033;
transition: box-shadow .3s ease-in-out;
}

&__pointer {
cursor: pointer;
}


&__text {
height: 100%;
Expand Down Expand Up @@ -49,4 +52,4 @@
padding-top: 1rem;
}
}
}
}
43 changes: 31 additions & 12 deletions e-commerce-app/src/components/ProductCard/ProductCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export const ProductCard: FC<ICardProps> = ({ item }) => {
navigate(`/products/${item.id}`);
};

const handlerAddToCart = () => {
console.log('here, add to cart');
};

const taxesArray = useAppSelector(getTaxes);

const [tax, setTax] = useState(0);
Expand Down Expand Up @@ -62,47 +66,62 @@ export const ProductCard: FC<ICardProps> = ({ item }) => {

return (
<Card className={styles.card}>
<Box width={'100%'}>
<CardMedia sx={{ height: 200, width: '100%' }} image={imgPath} title={imgDescription} />
<Box className={styles.card__pointer}
width={'100%'}
onClick={handlerNavigation}>
<CardMedia sx={{ height: 200, width: '100%' }}
image={imgPath}
title={imgDescription}/>
</Box>
<CardContent className={styles.card__text}>
<Typography className={styles.card__title} component="h2">
<CardContent className={`${styles.card__text} ${styles.card__pointer}`}
onClick={handlerNavigation}
sx={{ cursor: 'pointer' }}>
<Typography className={styles.card__title}
component="h2">
{item.masterData.current.name.en}
</Typography>

{tax !== 0 ? (
<>
<Typography className={styles.card__price__marked} component="h3">
<Typography className={styles.card__price__marked}
component="h3">
{salePriceEUR}
</Typography>
<Typography className={styles.card__price__sale} component="h3">
<Typography className={styles.card__price__sale}
component="h3">
{priceEUR}
</Typography>
</>
) : (
<Typography className={styles.card__price} component="h3">
<Typography className={styles.card__price}
component="h3">
{priceEUR}
</Typography>
)}

{tax !== 0 ? (
<>
<Typography className={styles.card__price__marked} component="h3">
<Typography className={styles.card__price__marked}
component="h3">
{salePriceUSD}
</Typography>
<Typography className={styles.card__price__sale} component="h3">
<Typography className={styles.card__price__sale}
component="h3">
{priceUSD}
</Typography>
</>
) : (
<Typography className={styles.card__price} component="h3">
<Typography className={styles.card__price}
component="h3">
{priceUSD}
</Typography>
)}
</CardContent>
<CardActions>
<Button onClick={handlerNavigation} color="success" variant="outlined">
Read more
<Button color="success"
variant="outlined"
onClick={handlerAddToCart}>
Add to Cart
</Button>
</CardActions>
</Card>
Expand Down