mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 12:24:18 +00:00
🎨 styles: cart drawer recommendation with single btn
:%s
This commit is contained in:
@@ -15,6 +15,7 @@ export interface CarouselCommonProps<T> {
|
|||||||
option: TOptionsEvents
|
option: TOptionsEvents
|
||||||
keenClassname?: string
|
keenClassname?: string
|
||||||
isPadding?: boolean
|
isPadding?: boolean
|
||||||
|
defaultComponentProps?: object
|
||||||
}
|
}
|
||||||
|
|
||||||
const CarouselCommon = <T,>({
|
const CarouselCommon = <T,>({
|
||||||
@@ -25,6 +26,7 @@ const CarouselCommon = <T,>({
|
|||||||
isPadding = false,
|
isPadding = false,
|
||||||
isArrow = true,
|
isArrow = true,
|
||||||
isDot = false,
|
isDot = false,
|
||||||
|
defaultComponentProps,
|
||||||
option: { slideChanged,slidesPerView, ...sliderOption },
|
option: { slideChanged,slidesPerView, ...sliderOption },
|
||||||
}: CarouselCommonProps<T>) => {
|
}: CarouselCommonProps<T>) => {
|
||||||
const [currentSlide, setCurrentSlide] = React.useState(0)
|
const [currentSlide, setCurrentSlide] = React.useState(0)
|
||||||
@@ -68,11 +70,14 @@ const CarouselCommon = <T,>({
|
|||||||
[s.isPadding]: isPadding,
|
[s.isPadding]: isPadding,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{data?.map((props, index) => (
|
{data?.map((props, index) => {
|
||||||
<div className="keen-slider__slide" key={`${itemKey}-${index}`}>
|
const allProps = defaultComponentProps ? { ...props, ...defaultComponentProps } : props
|
||||||
<Component {...props} />
|
return (
|
||||||
</div>
|
<div className="keen-slider__slide" key={`${itemKey}-${index}`}>
|
||||||
))}
|
<Component {...allProps} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
{slider && isArrow && (
|
{slider && isArrow && (
|
||||||
<>
|
<>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
.cartDrawer {
|
.cartDrawer {
|
||||||
@apply flex flex-col h-full;
|
@apply flex flex-col h-full;
|
||||||
.body {
|
.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 {
|
.bottom {
|
||||||
padding-top: 1.6rem;
|
padding-top: 1.6rem;
|
||||||
|
@@ -7,14 +7,20 @@ import { PRODUCT_DATA_TEST } from 'src/utils/demo-data';
|
|||||||
import s from './CartRecommendation.module.scss';
|
import s from './CartRecommendation.module.scss';
|
||||||
|
|
||||||
const option: TOptionsEvents = {
|
const option: TOptionsEvents = {
|
||||||
slidesPerView: 2,
|
slidesPerView: 1.5,
|
||||||
mode: 'free',
|
mode: 'free',
|
||||||
breakpoints: {
|
breakpoints: {
|
||||||
'(min-width: 640px)': {
|
'(min-width: 640px)': {
|
||||||
slidesPerView: 1,
|
slidesPerView: 1.5,
|
||||||
},
|
},
|
||||||
'(min-width: 768px)': {
|
'(min-width: 768px)': {
|
||||||
slidesPerView: 2.5,
|
slidesPerView: 2.5,
|
||||||
|
},
|
||||||
|
'(min-width: 1008px)': {
|
||||||
|
slidesPerView: 2.2,
|
||||||
|
},
|
||||||
|
'(min-width: 1440px)': {
|
||||||
|
slidesPerView: 2.5,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -34,6 +40,7 @@ const CartRecommendation = () => {
|
|||||||
Component={ProductCard}
|
Component={ProductCard}
|
||||||
itemKey="cart-recommendation"
|
itemKey="cart-recommendation"
|
||||||
option={option}
|
option={option}
|
||||||
|
defaultComponentProps={{ isSingleButton: true }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -57,13 +57,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.cardBot {
|
.cardBot {
|
||||||
min-height: 4rem;
|
|
||||||
@apply flex justify-between items-center;
|
@apply flex justify-between items-center;
|
||||||
|
min-height: 4rem;
|
||||||
|
margin-top: 1.6rem;
|
||||||
.cardIcon {
|
.cardIcon {
|
||||||
margin-right: 0.8rem;
|
margin-right: 0.8rem;
|
||||||
}
|
}
|
||||||
.cardButton {
|
.cardButton {
|
||||||
|
width: 100%;
|
||||||
button {
|
button {
|
||||||
|
width: 100%;
|
||||||
> div {
|
> div {
|
||||||
span {
|
span {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { IconBuy } from 'src/components/icons'
|
||||||
import { ROUTE } from 'src/utils/constanst.utils'
|
import { ROUTE } from 'src/utils/constanst.utils'
|
||||||
import { ProductProps } from 'src/utils/types.utils'
|
import { ProductProps } from 'src/utils/types.utils'
|
||||||
import ButtonCommon from '../ButtonCommon/ButtonCommon'
|
import ButtonCommon from '../ButtonCommon/ButtonCommon'
|
||||||
@@ -11,6 +12,7 @@ import ProductNotSell from './ProductNotSell/ProductNotSell'
|
|||||||
|
|
||||||
export interface ProductCardProps extends ProductProps {
|
export interface ProductCardProps extends ProductProps {
|
||||||
buttonText?: string
|
buttonText?: string
|
||||||
|
isSingleButton?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductCard = ({
|
const ProductCard = ({
|
||||||
@@ -21,6 +23,7 @@ const ProductCard = ({
|
|||||||
buttonText = 'Buy Now',
|
buttonText = 'Buy Now',
|
||||||
imageSrc,
|
imageSrc,
|
||||||
isNotSell,
|
isNotSell,
|
||||||
|
isSingleButton,
|
||||||
}: ProductCardProps) => {
|
}: ProductCardProps) => {
|
||||||
if (isNotSell) {
|
if (isNotSell) {
|
||||||
return <div className={`${s.productCardWarpper} ${s.notSell}`}>
|
return <div className={`${s.productCardWarpper} ${s.notSell}`}>
|
||||||
@@ -56,12 +59,22 @@ const ProductCard = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={s.cardBot}>
|
<div className={s.cardBot}>
|
||||||
<div className={s.cardIcon}>
|
{
|
||||||
<ButtonIconBuy />
|
isSingleButton ?
|
||||||
</div>
|
<div className={s.cardButton}>
|
||||||
<div className={s.cardButton}>
|
<ButtonCommon type="light" icon={<IconBuy />}>Add to cart</ButtonCommon>
|
||||||
<ButtonCommon type="light">{buttonText}</ButtonCommon>
|
</div>
|
||||||
</div>
|
:
|
||||||
|
<>
|
||||||
|
<div className={s.cardIcon}>
|
||||||
|
<ButtonIconBuy />
|
||||||
|
</div>
|
||||||
|
<div className={s.cardButton}>
|
||||||
|
<ButtonCommon type="light">{buttonText}</ButtonCommon>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user