Skip to content

Commit

Permalink
feat: wheel for carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
juliankoehn committed Feb 13, 2025
1 parent 6d04966 commit cb831d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"clsx": "^2.1.1",
"cross-env": "^7.0.3",
"embla-carousel-react": "^8.5.2",
"embla-carousel-wheel-gestures": "^8.0.1",
"graphql": "^16.8.1",
"lexical": "0.20.0",
"lucide-react": "^0.469.0",
Expand Down
20 changes: 20 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/components/ui/carousel/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from "react";
import { buttonVariants } from "../button";
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
import { WheelGesturesPlugin } from "embla-carousel-wheel-gestures";

type CarouselApi = UseEmblaCarouselType[1];
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
Expand Down Expand Up @@ -56,7 +57,7 @@ export const CarouselRoot = ({
orientation = "horizontal",
opts,
setApi,
plugins,
plugins = [],
className,
children,
...props
Expand All @@ -66,7 +67,7 @@ export const CarouselRoot = ({
...opts,
axis: orientation === "horizontal" ? "x" : "y",
},
plugins
[WheelGesturesPlugin(), ...plugins]
);
const [canScrollPrev, setCanScrollPrev] = useState(false);
const [canScrollNext, setCanScrollNext] = useState(false);
Expand Down

0 comments on commit cb831d6

Please sign in to comment.