mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
✨ feat: ProductCollection HomeRecipe
:%s
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
@import '../../../styles/utilities';
|
||||
|
||||
.subtitle {
|
||||
@apply spacing-horizontal-left;
|
||||
font-size: var(--font-size);
|
||||
line-height: var(--line-height);
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
@import '../../../styles/utilities';
|
||||
|
||||
.headingCommon {
|
||||
@apply heading-1 font-heading uppercase text-left spacing-horizontal-left;
|
||||
@apply heading-1 font-heading uppercase text-left;
|
||||
|
||||
&.highlight {
|
||||
color: var(--negative);
|
||||
@@ -13,7 +13,5 @@
|
||||
@apply text-center;
|
||||
}
|
||||
|
||||
@screen md {
|
||||
@apply spacing-horizontal;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { RecipeProps } from 'src/utils/types.utils'
|
||||
import s from './RecipeCard.module.scss'
|
||||
interface RecipeCardProps extends RecipeProps {}
|
||||
export interface RecipeCardProps extends RecipeProps {}
|
||||
|
||||
const RecipeCard = ({ imageSrc, title, description }: RecipeCardProps) => {
|
||||
return (
|
||||
|
@@ -0,0 +1,12 @@
|
||||
@import '../../../styles/utilities';
|
||||
.recipeCardWarpper {
|
||||
@apply spacing-horizontal;
|
||||
:global(.customArrow) {
|
||||
&:global(.leftArrow) {
|
||||
left: calc(-6.4rem - 2rem);
|
||||
}
|
||||
&:global(.rightArrow) {
|
||||
right: calc(-6.4rem - 2rem);
|
||||
}
|
||||
}
|
||||
}
|
40
src/components/common/RecipeCaroucel/RecipeCaroucel.tsx
Normal file
40
src/components/common/RecipeCaroucel/RecipeCaroucel.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { TOptionsEvents } from 'keen-slider'
|
||||
import React from 'react'
|
||||
import CarouselCommon, {
|
||||
CarouselCommonProps,
|
||||
} from '../CarouselCommon/CarouselCommon'
|
||||
import RecipeCard, { RecipeCardProps } from '../RecipeCard/RecipeCard'
|
||||
import s from "./RecipeCaroucel.module.scss"
|
||||
|
||||
interface RecipeCaroucelProps
|
||||
extends Omit<CarouselCommonProps<RecipeCardProps>, 'Component'|"option"> {
|
||||
option?:TOptionsEvents
|
||||
}
|
||||
|
||||
const OPTION_DEFAULT: TOptionsEvents = {
|
||||
slidesPerView: 1,
|
||||
mode: 'free',
|
||||
spacing:24,
|
||||
breakpoints: {
|
||||
'(min-width: 768px)': {
|
||||
slidesPerView: 2,
|
||||
},
|
||||
'(min-width: 1024px)': {
|
||||
slidesPerView: 3,
|
||||
},
|
||||
},
|
||||
}
|
||||
const RecipeCaroucel = ({ option, data, ...props }: RecipeCaroucelProps) => {
|
||||
return (
|
||||
<div className={s.recipeCardWarpper}>
|
||||
<CarouselCommon<RecipeCardProps>
|
||||
data={data}
|
||||
Component={RecipeCard}
|
||||
{...props}
|
||||
option={{ ...OPTION_DEFAULT, ...option }}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default RecipeCaroucel
|
@@ -15,3 +15,4 @@ export { default as Inputcommon} from './InputCommon/InputCommon'
|
||||
export { default as InputSearch} from './InputSearch/InputSearch'
|
||||
export { default as ButtonIconBuy} from './ButtonIconBuy/ButtonIconBuy'
|
||||
export { default as HeadingCommon } from './HeadingCommon/HeadingCommon'
|
||||
export { default as CollectionHeading } from './CollectionHeading/CollectionHeading'
|
||||
|
@@ -0,0 +1,12 @@
|
||||
@import '../../../../styles/utilities';
|
||||
.colectionCarcoucelWarpper {
|
||||
padding-top: 5.6rem;
|
||||
padding-bottom: 6.5rem;
|
||||
@apply flex flex-col ;
|
||||
.top {
|
||||
@apply spacing-horizontal flex w-full justify-between;
|
||||
.right{
|
||||
margin-right: 14.76;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
import React from 'react'
|
||||
import { CollectionHeading, ProductCaroucel, ViewAllItem } from 'src/components/common'
|
||||
import { ProductCardProps } from 'src/components/common/ProductCard/ProductCard'
|
||||
import s from './CollectionCarcoucel.module.scss'
|
||||
interface ColectionCarcoucelProps {
|
||||
data: ProductCardProps[]
|
||||
itemKey: string
|
||||
title: string
|
||||
subTitle: string
|
||||
viewAllLink?: string
|
||||
}
|
||||
|
||||
const ColectionCarcoucel = ({
|
||||
data,
|
||||
itemKey,
|
||||
title,
|
||||
subTitle,
|
||||
}: ColectionCarcoucelProps) => {
|
||||
return (
|
||||
<div className={s.colectionCarcoucelWarpper}>
|
||||
<div className={s.top}>
|
||||
<div className={s.left}>
|
||||
<CollectionHeading headingText={title} subtitle={subTitle} />
|
||||
</div>
|
||||
<div className={s.right}>
|
||||
<ViewAllItem/>
|
||||
</div>
|
||||
</div>
|
||||
<div className={s.bot}>
|
||||
<ProductCaroucel data={data} itemKey={itemKey} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ColectionCarcoucel
|
@@ -0,0 +1,33 @@
|
||||
@import '../../../../styles/utilities';
|
||||
|
||||
.homeRecipeWarpper {
|
||||
padding-top: 5.6rem;
|
||||
padding-bottom: 6.5rem;
|
||||
@apply flex flex-col;
|
||||
.top {
|
||||
@apply spacing-horizontal flex w-full justify-between;
|
||||
.right {
|
||||
margin-right: 14.76;
|
||||
}
|
||||
}
|
||||
.mid{
|
||||
padding-top: 3.2rem;
|
||||
padding-bottom: 3.2rem;
|
||||
@apply flex justify-start spacing-horizontal;
|
||||
.tab{
|
||||
padding: 1.6rem 1.6rem 0.8rem 1.6rem;
|
||||
font-size: 3.2rem;
|
||||
line-height: 4rem;
|
||||
outline: none;
|
||||
&.active{
|
||||
@apply text-background custom-border-radius bg-primary;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// :global(.keen-slider__slide){
|
||||
// @screen 2xl{
|
||||
// margin-right: 2rem;
|
||||
// }
|
||||
// }
|
||||
}
|
37
src/components/modules/home/HomeRecipe/HomeRecipe.tsx
Normal file
37
src/components/modules/home/HomeRecipe/HomeRecipe.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import React from 'react'
|
||||
import { HeadingCommon, ViewAllItem } from 'src/components/common'
|
||||
import { RecipeCardProps } from 'src/components/common/RecipeCard/RecipeCard'
|
||||
import RecipeCaroucel from 'src/components/common/RecipeCaroucel/RecipeCaroucel'
|
||||
import s from './HomeRecipe.module.scss'
|
||||
import classNames from 'classnames';
|
||||
interface HomeRecipeProps {
|
||||
data: RecipeCardProps[]
|
||||
itemKey: string
|
||||
title: string
|
||||
viewAllLink?: string
|
||||
}
|
||||
|
||||
const HomeRecipe = ({ data, itemKey, title }: HomeRecipeProps) => {
|
||||
return (
|
||||
<div className={s.homeRecipeWarpper}>
|
||||
<div className={s.top}>
|
||||
<div className={s.left}>
|
||||
<HeadingCommon headingText={title} />
|
||||
</div>
|
||||
<div className={s.right}>
|
||||
<ViewAllItem />
|
||||
</div>
|
||||
</div>
|
||||
<div className={s.mid}>
|
||||
<button className={classNames(s.tab,s.active)}>Noodle</button>
|
||||
<button className={s.tab}>Curry</button>
|
||||
<button className={s.tab}>Special Recipes</button>
|
||||
</div>
|
||||
<div className={s.bot}>
|
||||
<RecipeCaroucel data={data} itemKey={itemKey} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default HomeRecipe
|
@@ -1 +1,2 @@
|
||||
export { default as HomeBanner } from './HomeBanner/HomeBanner'
|
||||
export { default as CollectionCarcoucel } from './CollectionCarcoucel/CollectionCarcoucel'
|
||||
|
Reference in New Issue
Block a user