The Cards Stack Component is a visually engaging and interactive UI element designed to display a collection of cards in an overlapping, stacked format. This component enhances user interaction by allowing the cards to dynamically respond to user actions, creating a sense of depth and motion. Ideal for showcasing portfolios, product listings, or any content that benefits from a layered presentation.
The capital city of India, Delhi, is a blend of historic and modern attractions. Visitors can explore ancient monuments like the Red Fort and Humayun's Tomb, or enjoy the vibrant street life in markets like Chandni Chowk. Delhi's diverse culture and rich history make it a fascinating destination.
One of the most iconic monuments in the world, the Taj Mahal is a stunning example of Mughal architecture. Built by Emperor Shah Jahan in memory of his wife Mumtaz Mahal, this white marble mausoleum attracts millions of visitors each year..
Famous for its beaches, Goa is a paradise for beach lovers. From the lively Baga Beach to the tranquil Palolem Beach, there is a spot for everyone. Goa also offers vibrant nightlife, colonial architecture, and lush greenery.
The Golden Temple, or Harmandir Sahib, is the spiritual and cultural center of the Sikh religion. Its stunning golden architecture and serene surroundings make it a must-visit. The temple is known for its hospitality, serving free meals to thousands of visitors daily.
Known as the City of Lakes, Udaipur is famous for its palaces and scenic beauty. The City Palace, overlooking Lake Pichola, offers a glimpse into the royal past of Rajasthan. Udaipur's romantic ambiance makes it a popular destination for couples.
npm install framer-motion lenis
'use client'
import Image from 'next/image';
import { useTransform, motion, useScroll } from 'framer-motion';
import { useRef } from 'react';
export default function Card ({i, title, description, src, color, progress, range, targetScale}) {
const container = useRef(null);
const { scrollYProgress } = useScroll({
target: container,
offset: ['start end', 'start start']
})
const imageScale = useTransform(scrollYProgress, [0, 1], [2, 1])
const scale = useTransform(progress, range, [1, targetScale]);
return (
<div ref={container} className={`h-screen flex items-center justify-center sticky top-0`}>
<motion.div
style={{backgroundColor: color, scale, top:`calc(-5vh + ${i * 25}px)`}}
className={`flex flex-col relative h-[70%] w-full rounded-3xl p-10 `} >
<h2 className='text-center m-0 text-2xl'>{title}</h2>
<div className={`flex flex-row h-full mt-10 gap-3`}>
<div className={`w-full md:w-2/5 relative top-[10%]`}>
<p className='text-base'>{description}</p>
</div>
<div className={`relative w-3/5 h-full rounded-md overflow-hidden hidden md:inline-block`}>
<motion.div
className={`w-full h-full`}
style={{scale: imageScale}}
>
<Image
fill
src={`/assests/images/cards-stack/${src}`}
alt="image"
className='object-cover'
/>
</motion.div>
</div>
</div>
</motion.div>
</div>
)
}