diff --git a/src/components/SwipeableCard.tsx b/src/components/SwipeableCard.tsx index 0b777f3..3e25774 100644 --- a/src/components/SwipeableCard.tsx +++ b/src/components/SwipeableCard.tsx @@ -13,7 +13,8 @@ import RestaurantCard from "./RestaurantCard"; import { Restaurant, SwipeDirection } from "@/types"; const SWIPE_THRESHOLD = 120; -const EXIT_X = 600; +const getExitX = () => + typeof window !== "undefined" ? window.innerWidth * 1.5 : 600; const ROTATION_RANGE = 18; interface SwipeableCardProps { @@ -66,7 +67,8 @@ export default function SwipeableCard({ const flyOut = (direction: SwipeDirection) => { if (isSwiping.current) return; isSwiping.current = true; - const exitX = direction === "right" ? EXIT_X : -EXIT_X; + const exit = getExitX(); + const exitX = direction === "right" ? exit : -exit; animate(x, exitX, { type: "spring", stiffness: 600,