Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

387-brands-block #444

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
387-brands-block(product card change)
  • Loading branch information
Margarita22 committed Jun 28, 2024
commit 60e5c0c851bb0efafd3b85ee0d01acd5e57bcdeb
20 changes: 19 additions & 1 deletion src/entities/WidgetButtonsFunctions/WidgetButtonsFunctions.tsx
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import classnames from 'classnames'
import { FC } from 'react'

import IconCompare from '@/assets/icons/IconCompare.svg'
import IconEye from '@/assets/icons/IconEye.svg'
import IconLike from '@/assets/icons/IconLike'
import styles from '@/features/ProductItem/ProductItem.module.scss'
import { ECardView } from '@/shared/model/types/common'
@@ -16,6 +17,8 @@ type TWidgetButtonsFunctions = {
isInCompared: boolean
handleAddToCompared: VoidFunction
layout: ECardView
active?: boolean
onEyeClick?: VoidFunction
}

/**
@@ -25,13 +28,17 @@ type TWidgetButtonsFunctions = {
* @param {boolean} isInCompared - добавлен ли товар к списку для сравнения;
* @param {function} handleAddToCompared - функция добавления товара к списку для сравнения;
* @param {string} layout - текущий вид отображения карточки товара;
* @param {boolean} active - выводить или нет кнопку;
* @param {function} onEyeClick - функция открытия поп-апа с дополнительной информацией о товаре;
*/
export const WidgetButtonsFunctions: FC<TWidgetButtonsFunctions> = ({
isLiked,
handleLike,
isInCompared,
handleAddToCompared,
layout
layout,
active,
onEyeClick
}) => {
const theme = layout === ECardView.COMPACT ? ButtonTheme.OUTLINED : undefined
const size = layout === ECardView.COMPACT ? ButtonSize.S : ButtonSize.XS
@@ -64,6 +71,17 @@ export const WidgetButtonsFunctions: FC<TWidgetButtonsFunctions> = ({
})}
/>
</Button>
{active && (
<Button
className={classnames(stylesSvg.customButton, stylesSvg.customButton, {
[getStylesForCurrentLayout('customButton', stylesSvg)[layout]]: layout
})}
theme={theme}
size={size}
onClick={onEyeClick}>
<IconEye />
</Button>
)}
</>
)
}
11 changes: 0 additions & 11 deletions src/entities/WidgetButtonsPurchase/WidgetButtonsPurchase.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import classNames from 'classnames'
import { FC } from 'react'

import IconCart from '@/assets/icons/IconCart.svg'
import IconEye from '@/assets/icons/IconEye.svg'
import WB from '@/assets/icons/WB.svg'
import { ECardView } from '@/shared/model/types/common'
import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button'
@@ -12,7 +11,6 @@ import styles from './WidgetButtonsPurchase.module.scss'
type TWidgetButtonsPurchase = {
isInCart: boolean
handleAddToCart: VoidFunction
onEyeClick: VoidFunction
layout: ECardView
wb_urls?: string
}
@@ -21,14 +19,12 @@ type TWidgetButtonsPurchase = {
* Компонент (виджет) группы кнопок для добавления в корзину и открытия поп-апа с подробной информацией о товаре.
* @param {boolean} isInCart - добавлен ли товар в корзину;
* @param {function} handleAddToCart - функция добавления товара в корзину;
* @param {function} onEyeClick - функция открытия поп-апа с дополнительной информацией о товаре;
* @param {string} layout - текущий вид отображения карточки товара;
* @param {string} wb_urls ссылка на страницу с товаром на WB
*/
export const WidgetButtonsPurchase: FC<TWidgetButtonsPurchase> = ({
isInCart,
handleAddToCart,
onEyeClick,
layout,
wb_urls
}) => {
@@ -57,13 +53,6 @@ export const WidgetButtonsPurchase: FC<TWidgetButtonsPurchase> = ({
<WB />
</Button>
)}
<Button
className={classNames(styles.customButton, styles.customButton_eye)}
theme={ButtonTheme.OUTLINED}
size={size}
onClick={onEyeClick}>
<IconEye />
</Button>
</div>
)
}
8 changes: 6 additions & 2 deletions src/features/ProductItem/ProductItem.tsx
Original file line number Diff line number Diff line change
@@ -125,6 +125,8 @@ export const ProductItem: FC<IProductCardProps> = ({
handleLike={handleLike}
handleAddToCompared={handleAddToCompared}
layout={layout}
active={true}
onEyeClick={changeModalState}
/>
</div>
)}
@@ -148,6 +150,8 @@ export const ProductItem: FC<IProductCardProps> = ({
handleLike={handleLike}
handleAddToCompared={handleAddToCompared}
layout={layout}
active={true}
onEyeClick={changeModalState}
/>
</div>
)}
@@ -179,7 +183,6 @@ export const ProductItem: FC<IProductCardProps> = ({
<WidgetButtonsPurchase
isInCart={isInCart}
handleAddToCart={handleAddToCart}
onEyeClick={changeModalState}
layout={layout}
wb_urls={wb_urls}
/>
@@ -197,7 +200,6 @@ export const ProductItem: FC<IProductCardProps> = ({
<WidgetButtonsPurchase
isInCart={isInCart}
handleAddToCart={handleAddToCart}
onEyeClick={changeModalState}
layout={layout}
wb_urls={wb_urls}
/>
@@ -207,6 +209,8 @@ export const ProductItem: FC<IProductCardProps> = ({
handleLike={handleLike}
handleAddToCompared={handleAddToCompared}
layout={layout}
active={true}
onEyeClick={changeModalState}
/>
</div>
)}
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@

&__buttons {
display: flex;
width: 50px;
width: 90px;
height: 40px;
}

Loading