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
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
3 changes: 1 addition & 2 deletions src/entities/BrandCard/ui/BrandCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FC } from 'react'

import BrandWithoutImage from '@/assets/images/brands/brand-without-image.webp'
import { Routes } from '@/shared/config/routerConfig/routes'
import Link from '@/shared/ui/Link/Link'
import Img from '@/ui/img'
import { Brand } from '@/widgets/BrandBlock/types/types'
Expand All @@ -19,7 +18,7 @@ interface BrandCardProps {

const BrandCard: FC<BrandCardProps> = ({ card }) => {
return (
<Link className={styles.brandCard} to={`${Routes.BRANDS}/${card.slug}`}>
<Link className={styles.brandCard} to={'#'}>
<Img src={card.image || BrandWithoutImage} alt={card.name} className={styles.img} />
</Link>
)
Expand Down
3 changes: 2 additions & 1 deletion src/entities/NewsCard/ui/NewsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FC, useMemo } from 'react'

import NoImage from '@/assets/icons/image-not-found-icon.svg'
import { Routes } from '@/shared/config/routerConfig/routes'
import { TEXT_PROMO } from '@/shared/constants/constants'
import Heading, { HeadingType } from '@/shared/ui/Heading/Heading'
import Link from '@/shared/ui/Link/Link'
Expand Down Expand Up @@ -34,7 +35,7 @@ const NewsCard: FC<Props> = ({ image, date, title, link }) => {
}, [date])

return (
<Link to={link} className={styles.newsCard}>
<Link to={`${Routes.SHOP_NEWS}/${link}`} className={styles.newsCard}>
{image ? (
<img src={image} alt={'новость'} className={styles.image} />
) : (
Expand Down
20 changes: 19 additions & 1 deletion src/entities/WidgetButtonsFunctions/WidgetButtonsFunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -16,6 +17,8 @@ type TWidgetButtonsFunctions = {
isInCompared: boolean
handleAddToCompared: VoidFunction
layout: ECardView
active?: boolean
onEyeClick?: VoidFunction
}

/**
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Up @@ -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'
Expand All @@ -12,7 +11,6 @@ import styles from './WidgetButtonsPurchase.module.scss'
type TWidgetButtonsPurchase = {
isInCart: boolean
handleAddToCart: VoidFunction
onEyeClick: VoidFunction
layout: ECardView
wb_urls?: string
}
Expand All @@ -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
}) => {
Expand Down Expand Up @@ -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
Expand Up @@ -125,6 +125,8 @@ export const ProductItem: FC<IProductCardProps> = ({
handleLike={handleLike}
handleAddToCompared={handleAddToCompared}
layout={layout}
active={true}
onEyeClick={changeModalState}
/>
</div>
)}
Expand All @@ -148,6 +150,8 @@ export const ProductItem: FC<IProductCardProps> = ({
handleLike={handleLike}
handleAddToCompared={handleAddToCompared}
layout={layout}
active={true}
onEyeClick={changeModalState}
/>
</div>
)}
Expand Down Expand Up @@ -179,7 +183,6 @@ export const ProductItem: FC<IProductCardProps> = ({
<WidgetButtonsPurchase
isInCart={isInCart}
handleAddToCart={handleAddToCart}
onEyeClick={changeModalState}
layout={layout}
wb_urls={wb_urls}
/>
Expand All @@ -197,7 +200,6 @@ export const ProductItem: FC<IProductCardProps> = ({
<WidgetButtonsPurchase
isInCart={isInCart}
handleAddToCart={handleAddToCart}
onEyeClick={changeModalState}
layout={layout}
wb_urls={wb_urls}
/>
Expand All @@ -207,6 +209,8 @@ export const ProductItem: FC<IProductCardProps> = ({
handleLike={handleLike}
handleAddToCompared={handleAddToCompared}
layout={layout}
active={true}
onEyeClick={changeModalState}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

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

Expand Down
5 changes: 2 additions & 3 deletions src/widgets/BrandBlock/ui/BrandBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AppDispatch } from '@/app/providers/StoreProvider/config/store'
import BrandCard from '@/entities/BrandCard'
import HeadingBlock from '@/entities/HeadingBlock'
import LinkButton from '@/entities/LinkButton'
import { Routes } from '@/shared/config/routerConfig/routes'
import { TEXT_ALL_BRANDS, TEXT_OUR_BRANDS } from '@/shared/constants/constants'
import { useResize } from '@/shared/libs/hooks/useResize'
import Scroll from '@/shared/ui/Scroll/Scroll'
Expand Down Expand Up @@ -33,15 +32,15 @@ const BrandBlock: FC = () => {
return (
brands?.length !== 0 && (
<section className={styles.brandBlock}>
<HeadingBlock title={TEXT_OUR_BRANDS} isLink={true} subtitle={TEXT_ALL_BRANDS} link={Routes.BRANDS} />
<HeadingBlock title={TEXT_OUR_BRANDS} isLink={true} subtitle={TEXT_ALL_BRANDS} link={'#'} />

<Scroll withManualGrip={true}>
{brands.map(card => (
<li key={card.id}>
<BrandCard card={card} />
</li>
))}
{!isScreenMd && <LinkButton link={Routes.BRANDS} text={TEXT_ALL_BRANDS} />}
{!isScreenMd && <LinkButton link={'#'} text={TEXT_ALL_BRANDS} />}
</Scroll>
</section>
)
Expand Down
Loading