Merge pull request #53 from KieIO/m2-sonnguyen-hotfix

🎨 restyle: Home Feature
This commit is contained in:
lytrankieio123 2021-09-14 17:48:08 +07:00 committed by GitHub
commit 181c72c177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 88 additions and 80 deletions

View File

@ -1,16 +1,5 @@
@import "../../../../styles/utilities";
.homeFeature {
@apply spacing-horizontal;
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;
}
@apply spacing-horizontal-left bg-white;
}

View File

@ -1,23 +1,32 @@
import React from 'react'
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'
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 (
<section className={s.homeFeature}>
<HomeFeatureItem image="firstImg">
<span> Webshop owner will <b>upload products at 10:30pm </b>shoppers can buy <b>fresh products at 11pm.</b></span>
</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>
<div className={s.homeFeature}>
<HomeFeatureCarousel data={CAROUSEL_DATA} itemKey="Home Feature" isArrow={false} />
</div>
)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -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

View File

@ -1,56 +1,18 @@
@import "../../../../../../styles/utilities";
.homeFeatureItem {
@apply flex items-center;
width: fit-content;
margin: auto;
@screen md {
@apply flex flex-col items-center justify-between;
}
@screen lg {
@apply flex flex-row;
}
@apply flex items-center justify-center;
margin-right: 0.8rem;
height: 100%;
.itemImg {
@apply flex float-left clear-both;
margin-right: 2.4rem;
align-items: center;
&.firstImg {
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;
}
max-width: 12rem;
min-width: 8rem;
}
.itemText {
max-width: 28rem;
min-width: 12rem;
@screen md {
@apply text-center;
}
@screen lg {
@apply text-left;
}
min-width: none;
}
}

View File

@ -1,21 +1,21 @@
import React from 'react'
import classNames from 'classnames'
import s from './HomeFeatureItem.module.scss'
import { StaticImage } from 'src/components/common'
interface HomeFeatureItemProps {
image: string;
children: any;
export interface HomeFeatureItemProps {
image: StaticImageData;
children: React.ReactNode;
}
const HomeFeatureItem = ({ image, children }: HomeFeatureItemProps) => {
return (
<div className={s.homeFeatureItem}>
<img className={classNames(s.itemImg, {
[s[image]]: image,
})}
alt="home feature item img" />
<div className={s.itemImg}>
<StaticImage src={image} alt="home feature item img" />
</div>
<div className={s.itemText}>{children}</div>
</div>
)