diff --git a/package.json b/package.json index ffa0332..194508f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "date-fns": "^2.28.0", "dayjs": "^1.10.6", "ellipsize": "^0.5.1", + "embla-carousel-react": "^8.6.0", "express": "^4.20.0", "filename-parser": "^1.0.2", "final-form": "^4.20.2", @@ -48,7 +49,6 @@ "i18next-http-backend": "^2.5.0", "immer": "^10.0.3", "jsdoc": "^3.6.10", - "keen-slider": "^6.8.6", "lodash": "^4.17.21", "pretty-bytes": "^5.6.0", "prop-types": "^15.8.1", diff --git a/src/client/components/Dashboard/PullList.tsx b/src/client/components/Dashboard/PullList.tsx index eb3ae00..0b38ba6 100644 --- a/src/client/components/Dashboard/PullList.tsx +++ b/src/client/components/Dashboard/PullList.tsx @@ -1,4 +1,4 @@ -import React, { ReactElement, useState } from "react"; +import React, { ReactElement, useState, useCallback } from "react"; import { map } from "lodash"; import Card from "../shared/Carda"; import Header from "../shared/Header"; @@ -10,8 +10,7 @@ import axios from "axios"; import rateLimiter from "axios-rate-limit"; import { setupCache } from "axios-cache-interceptor"; import { useQuery } from "@tanstack/react-query"; -import "keen-slider/keen-slider.min.css"; -import { useKeenSlider } from "keen-slider/react"; +import useEmblaCarousel from "embla-carousel-react"; import { COMICVINE_SERVICE_URI } from "../../constants/endpoints"; import { Field, Form } from "react-final-form"; import DatePickerDialog from "../shared/DatePicker"; @@ -34,24 +33,13 @@ export const PullList = (): ReactElement => { format(date, "yyyy/M/dd"), ); - // keen slider - const [sliderRef, instanceRef] = useKeenSlider( - { - loop: true, - slides: { - origin: "auto", - number: 15, - perView: 5, - spacing: 15, - }, - slideChanged() { - console.log("slide changed"); - }, - }, - [ - // add plugins here - ], - ); + // embla carousel + const [emblaRef, emblaApi] = useEmblaCarousel({ + loop: false, + align: "start", + containScroll: "trimSnaps", + slidesToScroll: 1, + }); const { data: pullList, @@ -126,34 +114,41 @@ export const PullList = (): ReactElement => { {isSuccess && !isLoading && ( -
- {map(pullList?.data.result, (issue, idx) => { - return ( -
- -
- - {issue.publicationDate} - -
- -
+
+
+
+ {map(pullList?.data.result, (issue, idx) => { + return ( +
+ +
+ + {issue.publicationDate} + +
+ +
+
+
- -
- ); - })} + ); + })} +
+
)} {isLoading ?
Loading...
: null} diff --git a/yarn.lock b/yarn.lock index b558fdb..72972a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5402,6 +5402,24 @@ ellipsize@^0.5.1: resolved "https://registry.yarnpkg.com/ellipsize/-/ellipsize-0.5.1.tgz#2ac8bba69b2190d629cc5065a9c2bf28d99f237e" integrity sha512-0jEAyuIRU6U8MN0S5yUqIrkK/AQWkChh642N3zQuGV57s9bsUWYLc0jJOoDIUkZ2sbEL3ySq8xfq71BvG4q3hw== +embla-carousel-react@^8.6.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/embla-carousel-react/-/embla-carousel-react-8.6.0.tgz#b737042a32761c38d6614593653b3ac619477bd1" + integrity sha512-0/PjqU7geVmo6F734pmPqpyHqiM99olvyecY7zdweCw+6tKEXnrE90pBiBbMMU8s5tICemzpQ3hi5EpxzGW+JA== + dependencies: + embla-carousel "8.6.0" + embla-carousel-reactive-utils "8.6.0" + +embla-carousel-reactive-utils@8.6.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/embla-carousel-reactive-utils/-/embla-carousel-reactive-utils-8.6.0.tgz#607f1d8ab9921c906a555c206251b2c6db687223" + integrity sha512-fMVUDUEx0/uIEDM0Mz3dHznDhfX+znCCDCeIophYb1QGVM7YThSWX+wz11zlYwWFOr74b4QLGg0hrGPJeG2s4A== + +embla-carousel@8.6.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/embla-carousel/-/embla-carousel-8.6.0.tgz#abcedff2bff36992ea8ac27cd30080ca5b6a3f58" + integrity sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA== + emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" @@ -7920,11 +7938,6 @@ jsonfile@^6.0.1: object.assign "^4.1.4" object.values "^1.1.6" -keen-slider@^6.8.6: - version "6.8.6" - resolved "https://registry.yarnpkg.com/keen-slider/-/keen-slider-6.8.6.tgz#17bb7b219860f291a5ea5fde4496b737bf407a83" - integrity sha512-dcEQ7GDBpCjUQA8XZeWh3oBBLLmyn8aoeIQFGL/NTVkoEOsmlnXqA4QykUm/SncolAZYGsEk/PfUhLZ7mwMM2w== - keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"