Merge pull request #53 from KieIO/m2-sonnguyen-hotfix
🎨 restyle: Home Feature
@@ -1,16 +1,5 @@
|
|||||||
@import "../../../../styles/utilities";
|
@import "../../../../styles/utilities";
|
||||||
|
|
||||||
.homeFeature {
|
.homeFeature {
|
||||||
@apply spacing-horizontal;
|
@apply spacing-horizontal-left bg-white;
|
||||||
background-color: #ffffff;
|
|
||||||
height: fit-content;
|
|
||||||
margin: 3.2rem auto;
|
|
||||||
@screen md {
|
|
||||||
@apply grid grid-cols-3;
|
|
||||||
grid-gap: 2.4rem;
|
|
||||||
margin: 6.4rem auto;
|
|
||||||
}
|
|
||||||
@screen md {
|
|
||||||
grid-gap: 4rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,23 +1,32 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import s from './HomeFeature.module.scss'
|
import s from './HomeFeature.module.scss'
|
||||||
|
|
||||||
import HomeFeatureItem from './components/HomeFeatureItem/HomeFeatureItem'
|
import FirstPic from './assets/10h30-11h.png'
|
||||||
|
import SecondPic from './assets/8h.png'
|
||||||
|
import ThirdPic from './assets/green.png'
|
||||||
|
|
||||||
const HomeFeature = () => {
|
import HomeFeatureCarousel from './components/HomeFeatureCarousel/HomeFeatureCarousel'
|
||||||
|
|
||||||
|
const CAROUSEL_DATA = [
|
||||||
|
{
|
||||||
|
image: FirstPic,
|
||||||
|
children: <span>Webshop owner will <b>upload products at 10:30pm </b>shoppers can buy <b>fresh products at 11pm.</b></span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: SecondPic,
|
||||||
|
children: <span>Most fresh fish and seafood <b>will be listed at 8am </b>from inventory.</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: ThirdPic,
|
||||||
|
children: <span>Show that food will be shipped in <b>a greengrocery plastic bag</b>.</span>,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const HomeFeature = () => {
|
||||||
return (
|
return (
|
||||||
<section className={s.homeFeature}>
|
<div className={s.homeFeature}>
|
||||||
<HomeFeatureItem image="firstImg">
|
<HomeFeatureCarousel data={CAROUSEL_DATA} itemKey="Home Feature" isArrow={false} />
|
||||||
<span> Webshop owner will <b>upload products at 10:30pm </b>shoppers can buy <b>fresh products at 11pm.</b></span>
|
</div>
|
||||||
</HomeFeatureItem>
|
|
||||||
|
|
||||||
<HomeFeatureItem image="secondImg">
|
|
||||||
<span>Most fresh fish and seafood <b>will be listed at 8am </b>from inventory.</span>
|
|
||||||
</HomeFeatureItem>
|
|
||||||
|
|
||||||
<HomeFeatureItem image="thirdImg">
|
|
||||||
<span>Show that food will be shipped in <b>a greengrocery plastic bag</b>.</span>
|
|
||||||
</HomeFeatureItem>
|
|
||||||
</section>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
@@ -0,0 +1,48 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { TOptionsEvents } from 'keen-slider'
|
||||||
|
|
||||||
|
import HomeFeatureItem, {HomeFeatureItemProps} from '../HomeFeatureItem/HomeFeatureItem'
|
||||||
|
import CarouselCommon, {CarouselCommonProps} from '../../../../../common/CarouselCommon/CarouselCommon'
|
||||||
|
|
||||||
|
interface HomeFeatureCarouselProps
|
||||||
|
extends Omit<CarouselCommonProps<HomeFeatureItemProps>, 'Component' | "option"> {
|
||||||
|
option?: TOptionsEvents
|
||||||
|
}
|
||||||
|
|
||||||
|
const OPTION_DEFAULT: TOptionsEvents = {
|
||||||
|
slidesPerView: 1.2,
|
||||||
|
mode: 'free',
|
||||||
|
breakpoints: {
|
||||||
|
'(min-width: 640px)': {
|
||||||
|
slidesPerView: 1.8,
|
||||||
|
},
|
||||||
|
'(min-width: 768px)': {
|
||||||
|
slidesPerView: 2.1,
|
||||||
|
},
|
||||||
|
'(min-width: 1008px)': {
|
||||||
|
slidesPerView: 2.3,
|
||||||
|
},
|
||||||
|
'(min-width: 1280px)': {
|
||||||
|
slidesPerView: 2.8,
|
||||||
|
},
|
||||||
|
'(min-width: 1440px)': {
|
||||||
|
slidesPerView: 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const HomeFeatureCarousel = ({option, data, ...props} : HomeFeatureCarouselProps) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<CarouselCommon<HomeFeatureItemProps>
|
||||||
|
data={data}
|
||||||
|
Component={HomeFeatureItem}
|
||||||
|
{...props}
|
||||||
|
option={{ ...OPTION_DEFAULT, ...option }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeFeatureCarousel
|
@@ -1,56 +1,18 @@
|
|||||||
@import "../../../../../../styles/utilities";
|
@import "../../../../../../styles/utilities";
|
||||||
|
|
||||||
.homeFeatureItem {
|
.homeFeatureItem {
|
||||||
@apply flex items-center;
|
@apply flex items-center justify-center;
|
||||||
width: fit-content;
|
margin-right: 0.8rem;
|
||||||
margin: auto;
|
height: 100%;
|
||||||
|
|
||||||
@screen md {
|
|
||||||
@apply flex flex-col items-center justify-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
@screen lg {
|
|
||||||
@apply flex flex-row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.itemImg {
|
.itemImg {
|
||||||
@apply flex float-left clear-both;
|
|
||||||
margin-right: 2.4rem;
|
margin-right: 2.4rem;
|
||||||
align-items: center;
|
max-width: 12rem;
|
||||||
&.firstImg {
|
min-width: 8rem;
|
||||||
margin-top: 1rem;
|
|
||||||
content: url("../../assets/10h30-11h-desktop.png");
|
|
||||||
}
|
|
||||||
&.secondImg {
|
|
||||||
margin-top: 1rem;
|
|
||||||
content: url("../../assets/8h-desktop.png");
|
|
||||||
}
|
|
||||||
&.thirdImg {
|
|
||||||
margin-top: 1rem;
|
|
||||||
content: url("../../assets/green-desktop.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
@screen md {
|
|
||||||
@apply flex flex-col justify-center items-center;
|
|
||||||
margin: auto;
|
|
||||||
margin-top: 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@screen lg {
|
|
||||||
@apply flex float-left clear-both;
|
|
||||||
margin-right: 2.4rem;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemText {
|
.itemText {
|
||||||
max-width: 28rem;
|
max-width: 28rem;
|
||||||
min-width: 12rem;
|
min-width: none;
|
||||||
@screen md {
|
|
||||||
@apply text-center;
|
|
||||||
}
|
|
||||||
@screen lg {
|
|
||||||
@apply text-left;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import classNames from 'classnames'
|
|
||||||
import s from './HomeFeatureItem.module.scss'
|
import s from './HomeFeatureItem.module.scss'
|
||||||
|
|
||||||
|
import { StaticImage } from 'src/components/common'
|
||||||
|
|
||||||
interface HomeFeatureItemProps {
|
export interface HomeFeatureItemProps {
|
||||||
image: string;
|
image: StaticImageData;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HomeFeatureItem = ({ image, children }: HomeFeatureItemProps) => {
|
const HomeFeatureItem = ({ image, children }: HomeFeatureItemProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={s.homeFeatureItem}>
|
<div className={s.homeFeatureItem}>
|
||||||
<img className={classNames(s.itemImg, {
|
<div className={s.itemImg}>
|
||||||
[s[image]]: image,
|
<StaticImage src={image} alt="home feature item img" />
|
||||||
})}
|
</div>
|
||||||
alt="home feature item img" />
|
|
||||||
<div className={s.itemText}>{children}</div>
|
<div className={s.itemText}>{children}</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|