-
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
1 parent
7e5de88
commit 2d0629e
Showing
5 changed files
with
184 additions
and
9 deletions.
There are no files selected for viewing
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
79 changes: 79 additions & 0 deletions
79
src/modules/ProductDetailsPage/components/InfoAndPurchase/InfoAndPurchase.module.scss
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,79 @@ | ||
@import '../../../../styles/utils/mixins/mixin-media'; | ||
@import '../../../../styles/utils/mixins/mixin-typography'; | ||
@import '../../../../styles/utils/variables/colors'; | ||
|
||
.infoAndPurchase { | ||
display: flex; | ||
flex-direction: column; | ||
grid-column: span 4; | ||
|
||
@include onTablet { | ||
grid-column: 8 / 12; | ||
} | ||
|
||
@include onDesktop { | ||
grid-column: 14 / 20; | ||
} | ||
|
||
&__price { | ||
display: flex; | ||
gap: 8px; | ||
margin-bottom: 16px; | ||
@include h2-typography; | ||
} | ||
|
||
&__fullPrice { | ||
font-size: 22px; | ||
font-weight: 500; | ||
text-decoration-line: line-through; | ||
color: $color__secondary; | ||
} | ||
|
||
&__specs { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
} | ||
|
||
&__spec { | ||
display: flex; | ||
justify-content: space-between; | ||
font-size: 12px; | ||
color: $color__primary; | ||
|
||
&__title { | ||
font-weight: 600; | ||
color: $color__secondary; | ||
} | ||
|
||
&__text { | ||
font-weight: 700; | ||
} | ||
} | ||
|
||
&__buttons { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-bottom: 32px; | ||
} | ||
} | ||
|
||
.infoAndPurchase__DARK { | ||
.infoAndPurchase { | ||
&__price { | ||
@include typography-dark; | ||
} | ||
|
||
&__fullPrice { | ||
color: $color__dark-theme__secondary; | ||
} | ||
|
||
&__spec { | ||
color: $color__dark-theme__white; | ||
|
||
&__title { | ||
color: $color__dark-theme__secondary; | ||
} | ||
} | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/modules/ProductDetailsPage/components/InfoAndPurchase/InfoAndPurchase.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,51 @@ | ||
import React from 'react'; | ||
import cn from 'classnames'; | ||
|
||
import styles from './InfoAndPurchase.module.scss'; | ||
|
||
import { useAppSelector } from '../../../../store/hooks'; | ||
import { PreparedInfo, Product } from '../../../../types/Product'; | ||
|
||
import { AddToCart } from '../../../shared/AddToCart'; | ||
import { AddToFavourites } from '../../../shared/AddToFavourites'; | ||
|
||
type Props = { | ||
product: Product | null; | ||
info: PreparedInfo; | ||
}; | ||
|
||
export const InfoAndPurchase: React.FC<Props> = ({ product, info }) => { | ||
const { isDarkTheme } = useAppSelector((state) => state.theme); | ||
const { fullPrice, price, specs } = info; // eslint-disable-line object-curly-newline | ||
|
||
return ( | ||
<div | ||
className={cn(styles.infoAndPurchase, { | ||
[styles.infoAndPurchase__DARK]: isDarkTheme, | ||
})} | ||
> | ||
<div className={styles.infoAndPurchase__price}> | ||
<p>{`$${price}`}</p> | ||
<p className={styles.infoAndPurchase__fullPrice}>{`$${fullPrice}`}</p> | ||
</div> | ||
|
||
<div className={styles.infoAndPurchase__buttons}> | ||
{product && ( | ||
<> | ||
<AddToCart productItem={product} /> | ||
<AddToFavourites productItem={product} /> | ||
</> | ||
)} | ||
</div> | ||
|
||
<div className={styles.infoAndPurchase__specs}> | ||
{Object.entries(specs).map(([key, value]) => ( | ||
<div key={key} className={styles.infoAndPurchase__spec}> | ||
<p className={styles.infoAndPurchase__spec__title}>{key}</p> | ||
<p className={styles.infoAndPurchase__spec__text}>{value}</p> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
src/modules/ProductDetailsPage/components/InfoAndPurchase/index.ts
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 @@ | ||
export * from './InfoAndPurchase'; |
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