@camped-ui/parallax-scroll
Advanced tools
Comparing version
"use client"; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,6 +31,5 @@ exports.ParallaxScroll = void 0; | ||
const framer_motion_1 = require("framer-motion"); | ||
const framer_motion_2 = require("framer-motion"); | ||
const react_1 = require("react"); | ||
const React = __importStar(require("react")); | ||
const ParallaxScroll = ({ images, className, }) => { | ||
const gridRef = (0, react_1.useRef)(null); | ||
const gridRef = React === null || React === void 0 ? void 0 : React.useRef(null); | ||
const { scrollYProgress } = (0, framer_motion_1.useScroll)({ | ||
@@ -24,5 +46,5 @@ container: gridRef, | ||
const thirdPart = images.slice(2 * third); | ||
return ((0, jsx_runtime_1.jsx)("div", { className: (0, lib_1.cn)("h-[40rem] items-start overflow-y-auto w-full", className), ref: gridRef, children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 items-start max-w-5xl mx-auto gap-10 py-40 px-10", ref: gridRef, children: [(0, jsx_runtime_1.jsx)("div", { className: "grid gap-10", children: firstPart.map((el, idx) => ((0, jsx_runtime_1.jsx)(framer_motion_2.motion.div, { style: { y: translateFirst }, children: (0, jsx_runtime_1.jsx)("img", { src: el, className: "h-80 w-full object-cover object-left-top rounded-lg gap-10 !m-0 !p-0", height: "400", width: "400", alt: "thumbnail" }) }, "grid-1" + idx))) }), (0, jsx_runtime_1.jsx)("div", { className: "grid gap-10", children: secondPart.map((el, idx) => ((0, jsx_runtime_1.jsx)(framer_motion_2.motion.div, { style: { y: translateSecond }, children: (0, jsx_runtime_1.jsx)("img", { src: el, className: "h-80 w-full object-cover object-left-top rounded-lg gap-10 !m-0 !p-0", height: "400", width: "400", alt: "thumbnail" }) }, "grid-2" + idx))) }), (0, jsx_runtime_1.jsx)("div", { className: "grid gap-10", children: thirdPart.map((el, idx) => ((0, jsx_runtime_1.jsx)(framer_motion_2.motion.div, { style: { y: translateThird }, children: (0, jsx_runtime_1.jsx)("img", { src: el, className: "h-80 w-full object-cover object-left-top rounded-lg gap-10 !m-0 !p-0", height: "400", width: "400", alt: "thumbnail" }) }, "grid-3" + idx))) })] }) })); | ||
return ((0, jsx_runtime_1.jsx)("div", { className: (0, lib_1.cn)("h-[40rem] items-start overflow-y-auto w-full", className), ref: gridRef, children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 items-start max-w-5xl mx-auto gap-10 py-40 px-10", ref: gridRef, children: [(0, jsx_runtime_1.jsx)("div", { className: "grid gap-10", children: firstPart.map((el, idx) => ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { style: { y: translateFirst }, children: (0, jsx_runtime_1.jsx)("img", { src: el, className: "h-80 w-full object-cover object-left-top rounded-lg gap-10 !m-0 !p-0", height: "400", width: "400", alt: "thumbnail" }) }, "grid-1" + idx))) }), (0, jsx_runtime_1.jsx)("div", { className: "grid gap-10", children: secondPart.map((el, idx) => ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { style: { y: translateSecond }, children: (0, jsx_runtime_1.jsx)("img", { src: el, className: "h-80 w-full object-cover object-left-top rounded-lg gap-10 !m-0 !p-0", height: "400", width: "400", alt: "thumbnail" }) }, "grid-2" + idx))) }), (0, jsx_runtime_1.jsx)("div", { className: "grid gap-10", children: thirdPart.map((el, idx) => ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { style: { y: translateThird }, children: (0, jsx_runtime_1.jsx)("img", { src: el, className: "h-80 w-full object-cover object-left-top rounded-lg gap-10 !m-0 !p-0", height: "400", width: "400", alt: "thumbnail" }) }, "grid-3" + idx))) })] }) })); | ||
}; | ||
exports.ParallaxScroll = ParallaxScroll; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@camped-ui/parallax-scroll", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/index.js", | ||
@@ -12,7 +12,7 @@ "scripts": { | ||
"@camped-ui/lib": "^2.0.2", | ||
"framer-motion": "^11.1.7", | ||
"react": "^18.2.0" | ||
"framer-motion": "^11.1.7" | ||
}, | ||
"peerDependencies": { | ||
"@camped-ui/lib": "*", | ||
"framer-motion": "*", | ||
"react": "*" | ||
@@ -19,0 +19,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7436
16.73%56
64.71%+ Added
- Removed
- Removed
- Removed
- Removed