diff --git a/src/components/common/CarouselCommon/CarouselCommon.tsx b/src/components/common/CarouselCommon/CarouselCommon.tsx index 3b5854ed4..29f351ccb 100644 --- a/src/components/common/CarouselCommon/CarouselCommon.tsx +++ b/src/components/common/CarouselCommon/CarouselCommon.tsx @@ -15,6 +15,7 @@ export interface CarouselCommonProps { option: TOptionsEvents keenClassname?: string isPadding?: boolean + defaultComponentProps?: object } const CarouselCommon = ({ @@ -25,6 +26,7 @@ const CarouselCommon = ({ isPadding = false, isArrow = true, isDot = false, + defaultComponentProps, option: { slideChanged,slidesPerView, ...sliderOption }, }: CarouselCommonProps) => { const [currentSlide, setCurrentSlide] = React.useState(0) @@ -68,11 +70,14 @@ const CarouselCommon = ({ [s.isPadding]: isPadding, })} > - {data?.map((props, index) => ( -
- -
- ))} + {data?.map((props, index) => { + const allProps = defaultComponentProps ? { ...props, ...defaultComponentProps } : props + return ( +
+ +
+ ) + })} {slider && isArrow && ( <> diff --git a/src/components/common/CartDrawer/CartDrawer.module.scss b/src/components/common/CartDrawer/CartDrawer.module.scss index 126028d3c..3ff81bc0a 100644 --- a/src/components/common/CartDrawer/CartDrawer.module.scss +++ b/src/components/common/CartDrawer/CartDrawer.module.scss @@ -4,7 +4,7 @@ .cartDrawer { @apply flex flex-col h-full; .body { - @apply overflow-y-auto overflow-x-hidden h-full custom-scroll; + @apply flex flex-col justify-center overflow-y-auto overflow-x-hidden h-full custom-scroll; } .bottom { padding-top: 1.6rem; diff --git a/src/components/common/CartDrawer/components/CartRecommendation/CartRecommendation.tsx b/src/components/common/CartDrawer/components/CartRecommendation/CartRecommendation.tsx index bbc40647e..b275ceda5 100644 --- a/src/components/common/CartDrawer/components/CartRecommendation/CartRecommendation.tsx +++ b/src/components/common/CartDrawer/components/CartRecommendation/CartRecommendation.tsx @@ -7,14 +7,20 @@ import { PRODUCT_DATA_TEST } from 'src/utils/demo-data'; import s from './CartRecommendation.module.scss'; const option: TOptionsEvents = { - slidesPerView: 2, + slidesPerView: 1.5, mode: 'free', breakpoints: { '(min-width: 640px)': { - slidesPerView: 1, + slidesPerView: 1.5, }, '(min-width: 768px)': { slidesPerView: 2.5, + }, + '(min-width: 1008px)': { + slidesPerView: 2.2, + }, + '(min-width: 1440px)': { + slidesPerView: 2.5, } }, } @@ -34,6 +40,7 @@ const CartRecommendation = () => { Component={ProductCard} itemKey="cart-recommendation" option={option} + defaultComponentProps={{ isSingleButton: true }} /> diff --git a/src/components/common/ProductCard/ProductCard.module.scss b/src/components/common/ProductCard/ProductCard.module.scss index 2e62cc4d5..4a11c7ff0 100644 --- a/src/components/common/ProductCard/ProductCard.module.scss +++ b/src/components/common/ProductCard/ProductCard.module.scss @@ -57,13 +57,16 @@ } } .cardBot { - min-height: 4rem; @apply flex justify-between items-center; + min-height: 4rem; + margin-top: 1.6rem; .cardIcon { margin-right: 0.8rem; } .cardButton { + width: 100%; button { + width: 100%; > div { span { display: -webkit-box; diff --git a/src/components/common/ProductCard/ProductCard.tsx b/src/components/common/ProductCard/ProductCard.tsx index a6022efa4..f867d3724 100644 --- a/src/components/common/ProductCard/ProductCard.tsx +++ b/src/components/common/ProductCard/ProductCard.tsx @@ -1,5 +1,6 @@ import Link from 'next/link' import React from 'react' +import { IconBuy } from 'src/components/icons' import { ROUTE } from 'src/utils/constanst.utils' import { ProductProps } from 'src/utils/types.utils' import ButtonCommon from '../ButtonCommon/ButtonCommon' @@ -11,6 +12,7 @@ import ProductNotSell from './ProductNotSell/ProductNotSell' export interface ProductCardProps extends ProductProps { buttonText?: string + isSingleButton?: boolean, } const ProductCard = ({ @@ -21,6 +23,7 @@ const ProductCard = ({ buttonText = 'Buy Now', imageSrc, isNotSell, + isSingleButton, }: ProductCardProps) => { if (isNotSell) { return
@@ -56,12 +59,22 @@ const ProductCard = ({
-
- -
-
- {buttonText} -
+ { + isSingleButton ? +
+ }>Add to cart +
+ : + <> +
+ +
+
+ {buttonText} +
+ + } +
)