diff --git a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.module.scss b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.module.scss index 8c10f0d4..55e6ef01 100644 --- a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.module.scss +++ b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.module.scss @@ -1,56 +1,58 @@ -@use '../../../../shared/styles/utils/variables' as var; -@use '../../../../shared/styles/utils/mixins' as media; +@use '@/shared/styles/utils/variables' as var; +@use '@/shared/styles/utils/mixins' as media; -.description { - display: flex; - align-items: center; - padding: 10px; - background: var.$white; - border-radius: 10px; - height: 110px; - width: 60%; -} - -.frame { - width: 90px; - height: 90px; - display: flex; +.productEntity { + grid-area: productEntity; + display: grid; + grid-template-columns: 40% 1fr; align-items: center; - justify-content: center; - padding: 10px; - margin: 0 20px 0 0; - background: var.$white; - border-radius: 5px; + gap: 20px; + width: 100%; + max-width: 500px; @include media.respond-to('large') { - border: 1px solid var.$light-grey; + max-width: 100%; + } + + @include media.respond-to('middle') { + align-items: flex-start; + gap: 10px; + } + + &__imageBox { + display: flex; + align-items: center; + justify-content: center; } } .image { - display: flex; - max-height: 100%; - width: 70px; - height: 70px; + width: 100px; object-fit: cover; } -.description_wrapper { +.description { display: flex; flex-direction: column; - max-height: 80px; + gap: 2px; + width: 100%; + + @include media.respond-to('middle') { + flex-direction: column; + max-width: 100%; + } } .name { display: flex; font-size: 15px; - line-height: 1.35; font-weight: 700; color: var.$body-color; text-overflow: ellipsis; overflow: hidden; - - @include media.respond-to('large') { - width: 100%; + transition: 0.25s; + + &:hover { + color: var.$theme-primary-color; } } diff --git a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx index 321033e9..1cd8beb0 100644 --- a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx +++ b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx @@ -1,6 +1,7 @@ import { type FC } from 'react' import { IProduct } from '@/shared/model/types/ProductModel' +import Link from '@/shared/ui/Link/Link' import Subheading from '@/shared/ui/Subheading/Subheading' import styles from './ProductEntity.module.scss' @@ -9,23 +10,24 @@ import styles from './ProductEntity.module.scss' * Компонент служит для отображения товаров, пришедших с сервера. * @param {IImagesData[]} images-картика с изображением продукта; * @param {string} name- название продукта; - * @param {number} id -артикул продукта; + * @param {number} code -артикул продукта; * @param {number} price -стоимость продукта; * @param {string} currency - валюта, в которой обозначена стоимость; */ -export const ProductEntity: FC = product => { +export const ProductEntity: FC = ({ ...product }) => { return ( -
-
- {(product.images.length > 0 && ( - {'product'} - )) || <>} -
-
- {product.id} - {product.name} +
+
+ product
+ +
+ {product.code} + + {product.name} + +
) } diff --git a/src/features/CartEdit/ui/CartEdit/CartEdit.module.scss b/src/features/CartEdit/ui/CartEdit/CartEdit.module.scss index 0829ec83..5ffc5991 100644 --- a/src/features/CartEdit/ui/CartEdit/CartEdit.module.scss +++ b/src/features/CartEdit/ui/CartEdit/CartEdit.module.scss @@ -1,116 +1,84 @@ -@use '../../../../shared/styles/utils/variables' as var; -@use '../../../../shared/styles/utils/mixins' as media; +@use '@/shared/styles/utils/variables' as var; +@use '@/shared/styles/utils/mixins' as media; +@use '@/shared/styles/utils/z-index' as z-index; -.container { - display: flex; +.cartEdit { + position: relative; + display: grid; + grid-template-columns: 1fr 20% 20%; + grid-template-areas: 'productEntity count sumWrapper'; align-items: center; + gap: 20px; width: 100%; - min-width: 500px; - height: 140px; - background-color: var.$white; + min-height: 140px; + background: var.$white; border-radius: 10px; padding: 20px; - position: relative; - @include media.respond-to('large') { - width: 100%; - flex-direction: column; - height: 200px; - row-gap: 20px; - padding-right: 20px; - } -} - -.product { - display: flex; - align-items: center; - width: 70%; - - @include media.respond-to('large') { - width: 100%; + @include media.respond-to('middle') { + grid-template-columns: 40% 1fr; + grid-template-areas: + 'productEntity productEntity' + 'count sumWrapper'; + gap: 5px; } } .input { - display: flex; + width: 100%; + max-width: 40px; font-size: 18px; - line-height: 28px; font-weight: 500; letter-spacing: 0.1px; - background: inherit; - height: 100%; - min-width: 20px; - max-width: 40px; text-align: center; - appearance: none; - outline: none; - margin-left: 1px; - margin-right: 1px; } .counter { + grid-area: count; + display: flex; + justify-self: center; + height: 50px; border: 1px solid var.$light-grey; border-radius: 4px; - display: flex; - align-items: center; - justify-content: space-between; - background-color: inherit; padding: 4px; - height: 48px; - - @include media.respond-to('large') { - width: 100%; - } } .button { - border: none; - background: none; - padding: 0; - font-family: inherit; display: flex; align-items: center; justify-content: center; - width: 50px; // bug поменяла 20 на 50 для того,чтобы svg отображался в storybook, при 20px в storybook svg сжимается сильно и пропадает, на сайте padding от - - -
- -
-
    -
  • - -
  • -
  • - -
  • -
-
-
+
  • + + +
    + + +
    - + +
    + + {calculateProductPrice(productWithInfo.amount, String(productWithInfo.product.price))} +  ₽ + + {productWithInfo.product.price} ₽/шт +
    + + +
    +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    +
  • ) } diff --git a/src/pages/CartPage/CartPage.module.scss b/src/pages/CartPage/CartPage.module.scss index a942fbb7..887146bc 100644 --- a/src/pages/CartPage/CartPage.module.scss +++ b/src/pages/CartPage/CartPage.module.scss @@ -1,9 +1,21 @@ -@use '../../shared/styles/utils/variables' as var; -@use '../../shared/styles/utils/mixins' as media; +@use '@/shared/styles/utils/variables' as var; +@use '@/shared/styles/utils/mixins' as media; + +.titleBox { + display: flex; + flex-direction: column; + gap: 10px; + width: 100%; +} + +.heading { + padding-top: 20px; +} .container { display: flex; column-gap: 20px; + margin-top: -18px; margin-bottom: 160px; width: 100%; @@ -26,10 +38,6 @@ row-gap: 10px; } -.heading { - margin-top: 20px; -} - .titles { display: flex; flex-direction: column; diff --git a/src/pages/CartPage/CartPage.tsx b/src/pages/CartPage/CartPage.tsx index be6ac7f7..b25ce2b9 100644 --- a/src/pages/CartPage/CartPage.tsx +++ b/src/pages/CartPage/CartPage.tsx @@ -1,17 +1,22 @@ import { useSelector } from 'react-redux' -import { Link } from 'react-router-dom' import { getCartSelector } from '@/entities/CartEntity/model/selectors/selectors' import type { ICartEntity } from '@/entities/CartEntity/model/types/types' import { CartCouponApply } from '@/features/CartCouponApply/ui/CartCouponApply/CartCouponApply' import { CartEdit } from '@/features/CartEdit/ui/CartEdit/CartEdit' +import { Routes } from '@/shared/config/routerConfig/routes' +import Breadcrumbs from '@/shared/ui/Breadcrumbs/Breadcrumbs' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' -import Subheading from '@/shared/ui/Subheading/Subheading' import WrapperForMainContent from '@/shared/ui/WrapperForMainContent/WrapperForMainContent' import { MakeOrder } from '@/widgets/MakeOrder/ui/MakeOrder/MakeOrder' import styles from './CartPage.module.scss' +const links = [ + { heading: 'Главная', href: Routes.HOME }, + { heading: 'Корзина покупок', href: '' } +] + /** * Компонент страница корзины. На странице отображаются товары в корзине, можно изменять кол-во товаров в корзине, * сразу происходит изменение стоимости. Также можно добавить сертификат или купон на скидку, есть опция оформения быстрого и обычного заказа @@ -21,27 +26,21 @@ const CartPage = () => { return ( -
    - - Оформление заказа ({cart.cart_full_weight.toFixed(2)} кг) - {/* Кг приходит с бека или нет, tbd */} - - - - Главная - {' '} - / Корзина покупок - - +
    + Оформление заказа ({cart.cart_full_weight.toFixed(2)} кг) + + Ваши покупки -
    + +
    -
    - {cart.products.map(item => { - return - })} -
    +
      + {cart.products.map(item => ( + + ))} +
    +
    total + item.amount, 0)}