Add group class to Collapsible for state change listening#281
Add group class to Collapsible for state change listening#281ixfloma wants to merge 1 commit intoshadcnblocks:mainfrom
Conversation
|
@ixfloma is attempting to deploy a commit to the Haste Ventures Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughUpdates a Collapsible usage by adding a group/collapsible class to listen for group-data state and modifying the ChevronDown icon’s rotation classes to rely on that state. Adds inline comments describing the new behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/docs/app/patterns/components/client.tsx (2)
218-219: LGTM! Consider refining the comment.The
group/collapsibleclass correctly enables Tailwind's group-data state variants. The implementation is sound and fixes the chevron animation issue.However, the comment could be more concise and grammatically correct. Consider:
- // Seems group hasn't declared yet, this is important to listen the group-data state change + // Named group enables group-data state variants for child elements className="group/collapsible"
238-239: LGTM! Consider refining the comment.The rotation classes correctly implement the chevron animation. The explicit
rotate-0initial state is good practice, and-rotate-180provides the intended clockwise rotation effect.However, the comment has a grammatical error. Consider:
- {/* this chevron group-data now listen to group/collapsible */} + {/* Chevron rotation responds to collapsible group state */} <ChevronDown className="ml-auto transition-transform rotate-0 group-data-[state=open]/collapsible:-rotate-180" />
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Description
Added proper
group/collapsibledeclaration to ensure the chevron icon animates correctly when the collapsible is opened.Previously, the chevron rotation did not trigger because the parent group class was missing, so Tailwind’s
group-data-[state=open]/collapsible:rotate-180variant had no effect.Related Issues
No linked issue
Checklist
Screenshots (if applicable)
Additional Notes
I've added the initial state of
rotate-0and change the rotation into-rotate-180since it felt unintuitive rotating counter-clockwiseSummary by CodeRabbit