-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat (#332) : added the list stack #360
base: main
Are you sure you want to change the base?
Conversation
🚀 Preview deployed to: https://1d2c58d3.animata.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the comments. Also, make sure to use the same duration so the animations look better.
<AnimatePresence> | ||
{showAll | ||
? cards.map((card, index) => ( | ||
<motion.div | ||
key={card.id} | ||
custom={index} | ||
variants={revealAnimation} | ||
initial="hidden" | ||
animate="visible" | ||
exit="hidden" | ||
className="mb-3" | ||
> | ||
<CardStack | ||
id={card.id} | ||
icon={card.icon} | ||
title={card.title} | ||
location={card.location} | ||
date={card.date} | ||
/> | ||
</motion.div> | ||
)) | ||
: cards.map((card, index) => ( | ||
<motion.div | ||
key={card.id} | ||
custom={index} | ||
variants={stackAnimation} | ||
initial="hidden" | ||
animate="visible" | ||
exit="hidden" | ||
style={{ | ||
position: "absolute", | ||
transformOrigin: "top center", | ||
zIndex: cards.length - index, | ||
}} | ||
> | ||
<CardStack | ||
id={card.id} | ||
icon={card.icon} | ||
title={card.title} | ||
location={card.location} | ||
date={card.date} | ||
/> | ||
</motion.div> | ||
))} | ||
</AnimatePresence> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the conditional rendering here. Just conditionally change the CSS style (transform).
{showAll ? ( | ||
<> | ||
<div className="flex flex-row items-center gap-1.5"> | ||
<p>Hide</p> | ||
<motion.div | ||
initial={{ rotate: 0 }} | ||
animate={{ rotate: 180 }} | ||
transition={{ duration: 0.4 }} | ||
> | ||
<ChevronDown /> | ||
</motion.div> | ||
</div> | ||
</> | ||
) : ( | ||
<> | ||
<div className="flex flex-row items-center gap-1.5"> | ||
<p>Show All</p> | ||
<motion.div | ||
initial={{ rotate: 0 }} | ||
animate={{ rotate: 0 }} | ||
transition={{ duration: 0.4 }} | ||
> | ||
<ChevronDown /> | ||
</motion.div> | ||
</div> | ||
</> | ||
)} | ||
</motion.button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, you can conditionally change the text and the rotate property of the chevron, keeping the same elements.
Video preview:
hack-2.mov
Do suggest any changes @hari
Closes #332