🔨 refactor: delete keen-silder

:%s
This commit is contained in:
DatNguyen
2021-09-20 14:36:37 +07:00
parent c2a9b6610f
commit 3b2eaef7a6
14 changed files with 8 additions and 116 deletions

View File

@@ -31,7 +31,6 @@
"eslint-config-next": "^11.1.2", "eslint-config-next": "^11.1.2",
"immutability-helper": "^3.1.1", "immutability-helper": "^3.1.1",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"keen-slider": "^5.5.1",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"lodash.random": "^3.2.0", "lodash.random": "^3.2.0",
"lodash.throttle": "^4.1.1", "lodash.throttle": "^4.1.1",

View File

@@ -2,7 +2,6 @@ import { ThemeProvider } from 'next-themes';
import type { AppProps } from 'next/app'; import type { AppProps } from 'next/app';
import React, { FC, useEffect } from 'react'; import React, { FC, useEffect } from 'react';
import { CustomShapeSvg, Head } from 'src/components/common'; import { CustomShapeSvg, Head } from 'src/components/common';
import 'keen-slider/keen-slider.min.css';
import '../src/styles/main.scss'; import '../src/styles/main.scss';

View File

@@ -1,4 +1,3 @@
import { TOptionsEvents } from 'keen-slider'
import React, { memo } from 'react' import React, { memo } from 'react'
import { ResponsiveType } from 'react-multi-carousel' import { ResponsiveType } from 'react-multi-carousel'
import CarouselCommon from '../CarouselCommon/CarouselCommon' import CarouselCommon from '../CarouselCommon/CarouselCommon'

View File

@@ -1,5 +1,4 @@
import React, { useEffect, useRef } from 'react' import React, { useEffect, useRef } from 'react'
import 'keen-slider/keen-slider.min.css'
import { CustomCarouselArrow } from './CustomArrow/CustomCarouselArrow' import { CustomCarouselArrow } from './CustomArrow/CustomCarouselArrow'
import s from './CarouselCommon.module.scss' import s from './CarouselCommon.module.scss'
import classNames from 'classnames' import classNames from 'classnames'
@@ -15,7 +14,6 @@ export interface CarouselCommonProps<T>
data: T[] data: T[]
Component: React.ComponentType<T> Component: React.ComponentType<T>
itemKey: String itemKey: String
keenClassname?: string
isPadding?: boolean isPadding?: boolean
defaultComponentProps?: object defaultComponentProps?: object
responsive?: ResponsiveType responsive?: ResponsiveType

View File

@@ -1,4 +1,3 @@
import { TOptionsEvents } from 'keen-slider';
import React from 'react'; import React from 'react';
import { ResponsiveType } from 'react-multi-carousel'; import { ResponsiveType } from 'react-multi-carousel';
import { CarouselCommon, ViewAllItem } from 'src/components/common'; import { CarouselCommon, ViewAllItem } from 'src/components/common';

View File

@@ -5,7 +5,7 @@ import { LANGUAGE } from '../../../utils/language.utils'
import ButtonIconBuy from '../ButtonIconBuy/ButtonIconBuy' import ButtonIconBuy from '../ButtonIconBuy/ButtonIconBuy'
import ButtonCommon from '../ButtonCommon/ButtonCommon' import ButtonCommon from '../ButtonCommon/ButtonCommon'
import { ImgWithLink } from '..' import { ImgWithLink } from '..'
interface FeaturedProductCardProps extends FeaturedProductProps { export interface FeaturedProductCardProps extends FeaturedProductProps {
buttonText?: string buttonText?: string
} }

View File

@@ -1,5 +1,4 @@
import classNames from 'classnames'; import classNames from 'classnames';
import { TOptionsEvents } from 'keen-slider';
import React from 'react'; import React from 'react';
import { ResponsiveType } from 'react-multi-carousel'; import { ResponsiveType } from 'react-multi-carousel';
import CarouselCommon from '../CarouselCommon/CarouselCommon'; import CarouselCommon from '../CarouselCommon/CarouselCommon';
@@ -13,30 +12,7 @@ interface Props {
subtitle?: string, subtitle?: string,
hasBorderBottomMobile?: boolean, hasBorderBottomMobile?: boolean,
} }
const OPTION_DEFAULT: TOptionsEvents = {
slidesPerView: 2,
mode: 'free',
breakpoints: {
'(min-width: 640px)': {
slidesPerView: 3,
},
'(min-width: 768px)': {
slidesPerView: 3,
},
'(min-width: 1008px)': {
slidesPerView: 3.5,
},
'(min-width: 1024px)': {
slidesPerView: 2.5,
},
'(min-width: 1280px)': {
slidesPerView: 3.5,
},
'(min-width: 1440px)': {
slidesPerView: 4.5,
},
},
}
const RESPONSIVE:ResponsiveType = { const RESPONSIVE:ResponsiveType = {
xxl: { xxl: {
breakpoint: { max: 9999, min: 1440 }, breakpoint: { max: 9999, min: 1440 },

View File

@@ -1,4 +1,3 @@
// import { TOptionsEvents } from 'keen-slider'
import React from 'react' import React from 'react'
import CarouselCommon, { import CarouselCommon, {
CarouselCommonProps, CarouselCommonProps,

View File

@@ -1,4 +1,3 @@
import { TOptionsEvents } from 'keen-slider'
import React from 'react' import React from 'react'
import { ResponsiveType } from 'react-multi-carousel' import { ResponsiveType } from 'react-multi-carousel'
import CarouselCommon, { import CarouselCommon, {
@@ -10,25 +9,6 @@ import s from './RecipeCarousel.module.scss'
interface RecipeCarouselProps interface RecipeCarouselProps
extends Omit<CarouselCommonProps<RecipeCardProps>, 'Component' | 'option'> {} extends Omit<CarouselCommonProps<RecipeCardProps>, 'Component' | 'option'> {}
const OPTION_DEFAULT: TOptionsEvents = {
slidesPerView: 1.25,
mode: 'free',
spacing: 24,
breakpoints: {
'(min-width: 640px)': {
slidesPerView: 2,
},
'(min-width: 1024px)': {
slidesPerView: 2.5,
},
'(min-width: 1440px)': {
slidesPerView: 3,
},
'(min-width: 1536px)': {
slidesPerView: 3.5,
},
},
}
const RESPONSIVE: ResponsiveType = { const RESPONSIVE: ResponsiveType = {
largeDesktop: { largeDesktop: {
breakpoint: { max: 9999, min: 1536 }, breakpoint: { max: 9999, min: 1536 },

View File

@@ -1,4 +1,3 @@
import { TOptionsEvents } from 'keen-slider';
import React from 'react'; import React from 'react';
import { ResponsiveType } from 'react-multi-carousel'; import { ResponsiveType } from 'react-multi-carousel';
import { CarouselCommon, HeadingCommon, RecipeCard, ViewAllItem } from 'src/components/common'; import { CarouselCommon, HeadingCommon, RecipeCard, ViewAllItem } from 'src/components/common';

View File

@@ -1,4 +1,3 @@
import { TOptionsEvents } from 'keen-slider'
import React from 'react' import React from 'react'
import CarouselCommon, { import CarouselCommon, {
CarouselCommonProps, CarouselCommonProps,

View File

@@ -1,4 +1,3 @@
import { TOptionsEvents } from 'keen-slider'
import React from 'react' import React from 'react'
import { ResponsiveType } from 'react-multi-carousel' import { ResponsiveType } from 'react-multi-carousel'
import { CarouselCommon, FeaturedProductCard } from 'src/components/common' import { CarouselCommon, FeaturedProductCard } from 'src/components/common'
@@ -27,40 +26,14 @@ const dataDemo:FeaturedProductCardProps[] = [{
price: "$14.00", price: "$14.00",
imageSrc: "https://user-images.githubusercontent.com/76099413/133043633-954c105b-c703-4e5c-8f5f-7943ad633ff0.png" imageSrc: "https://user-images.githubusercontent.com/76099413/133043633-954c105b-c703-4e5c-8f5f-7943ad633ff0.png"
}] }]
const OPTION_DEFAULT: TOptionsEvents = {
slidesPerView: 1,
mode: 'free',
breakpoints: {
'(min-width: 300px)': {
slidesPerView: 1.5,
},
'(min-width: 400px)': {
slidesPerView: 2,
},
'(min-width: 640px)': {
slidesPerView: 1.25,
},
'(min-width: 768px)': {
slidesPerView: 1.075,
},
'(min-width: 968px)': {
slidesPerView: 1.175,
},
'(min-width: 1024px)': {
slidesPerView: 1.375,
},'(min-width: 1148px)': {
slidesPerView: 1.5,
},'(min-width: 1280px)': {
slidesPerView: 1.75,
},'(min-width: 1440px)': {
slidesPerView: 2.075,
},
},
}
const RESPONSIVE: ResponsiveType = { const RESPONSIVE: ResponsiveType = {
hugeScreen: {
breakpoint: { max: 9999, min: 1500 },
items: 2.25,
slidesToSlide: 1, // optional, default to 1.
},
largeScreen: { largeScreen: {
breakpoint: { max: 9999, min: 1440 }, breakpoint: { max: 1500, min: 1440 },
items: 2.075, items: 2.075,
slidesToSlide: 1, // optional, default to 1. slidesToSlide: 1, // optional, default to 1.
}, },

View File

@@ -1,6 +1,4 @@
import React from 'react' import React from 'react'
import { TOptionsEvents } from 'keen-slider'
import HomeFeatureItem, {HomeFeatureItemProps} from '../HomeFeatureItem/HomeFeatureItem' import HomeFeatureItem, {HomeFeatureItemProps} from '../HomeFeatureItem/HomeFeatureItem'
import CarouselCommon, {CarouselCommonProps} from '../../../../../common/CarouselCommon/CarouselCommon' import CarouselCommon, {CarouselCommonProps} from '../../../../../common/CarouselCommon/CarouselCommon'
import { ResponsiveType } from 'react-multi-carousel' import { ResponsiveType } from 'react-multi-carousel'
@@ -9,27 +7,6 @@ interface HomeFeatureCarouselProps
extends Omit<CarouselCommonProps<HomeFeatureItemProps>, 'Component' | "option"> { extends Omit<CarouselCommonProps<HomeFeatureItemProps>, 'Component' | "option"> {
} }
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 RESPONSIVE: ResponsiveType = { const RESPONSIVE: ResponsiveType = {
largeDesktop: { largeDesktop: {
breakpoint: { max: 9999, min: 1440 }, breakpoint: { max: 9999, min: 1440 },

View File

@@ -4255,11 +4255,6 @@ jws@^3.2.2:
jwa "^1.4.1" jwa "^1.4.1"
safe-buffer "^5.0.1" safe-buffer "^5.0.1"
keen-slider@^5.5.1:
version "5.5.1"
resolved "https://registry.yarnpkg.com/keen-slider/-/keen-slider-5.5.1.tgz#1493f552eadf0f5b8229defd83c626eb6dd58c13"
integrity sha512-QXGZGt5Hbe0YufR/RYbOG03MmOk43RQEXqkkSvjr8ZS67sVR7LRp5RIvJALfjl+A7BnHNr1wd1QBOemwy65Lfw==
keyv@^3.0.0: keyv@^3.0.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9"