forked from infoshareacademy/jfdzr12-project-react
-
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.
add BasteItems component, add solution to adding iem po basket and sh…
…ow item at basket
- Loading branch information
1 parent
d5848d6
commit 8aec068
Showing
5 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
my-app/src/Components/BasketModal/BasketItem/BasketItem.module.css
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,3 @@ | ||
.basket-item__product-image { | ||
height: 100px; | ||
} |
29 changes: 29 additions & 0 deletions
29
my-app/src/Components/BasketModal/BasketItem/BasketItem.tsx
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,29 @@ | ||
import React, { useContext } from 'react'; | ||
import styles from "./BasketItem.module.css"; | ||
import classNames from 'classnames'; | ||
import { ThemeContext } from '../../../providers/theme'; | ||
|
||
interface Product { | ||
author: string; | ||
height: number; | ||
id: number; | ||
price: number; | ||
url: string; | ||
width: number; | ||
} | ||
|
||
interface BasketItemProps { | ||
product: Product; | ||
} | ||
|
||
export const BasketItem: React.FC<BasketItemProps> = ({ product }) => { | ||
const { theme } = useContext(ThemeContext); | ||
|
||
return ( | ||
<div> | ||
<h3>{product.author}</h3> | ||
<img className={classNames(styles["basket-item__product-image"], styles[theme])} src={product.url}></img> | ||
<p>{product.price}$</p> | ||
</div> | ||
); | ||
} |
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