Skip to content

Conversation

@smmitc
Copy link

@smmitc smmitc commented Dec 18, 2025

The mobile menu contains an exit animation. But it is not working because it is not wrapped in an AnimatePresence component as described here. This is fixed by this PR.

Summary by CodeRabbit

  • Style
    • Enhanced mobile menu animations for smoother opening and closing transitions on the Figma header and home header navigation menus.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 18, 2025

@smmitc is attempting to deploy a commit to the tweakcn OSS program Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

Both header components now wrap their mobile menu rendering with AnimatePresence from Framer Motion to manage exit/enter animations, enabling smoother unmount transitions while preserving existing functionality and user interactions.

Changes

Cohort / File(s) Summary
Mobile Menu Animation Enhancements
components/figma-header.tsx, components/home/header.tsx
Added AnimatePresence import and wrapped conditional mobile menu rendering with AnimatePresence blocks to enable smooth exit/enter animations. In components/home/header.tsx, added visual underline effects to menu items and repositioned the "Try It Now" block within the animated container.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Both files receive consistent, parallel animation enhancements with minimal logic changes
  • Import updates are straightforward; wrapping patterns are identical across files
  • Minor addition of visual UI elements (span for underline) in components/home/header.tsx

Poem

🐰 A hop, a skip, the menus dance!
With AnimatePresence's gentle glance,
Framer Motion makes them fade so right,
Mobile magic, smooth and light!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding AnimatePresence wrapper to fix the mobile menu exit animation that wasn't working.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce7e81 and af03dc4.

📒 Files selected for processing (2)
  • components/figma-header.tsx (2 hunks)
  • components/home/header.tsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/figma-header.tsx (1)
utils/format.ts (1)
  • formatCompactNumber (4-9)
🔇 Additional comments (4)
components/home/header.tsx (2)

10-10: LGTM! Import correctly adds AnimatePresence.

The import change properly adds AnimatePresence which is required for exit animations in the Motion library.


140-147: LGTM! AnimatePresence wrapper correctly enables exit animations.

The mobile menu is now properly wrapped in AnimatePresence with a motion.div that has matching initial and exit states. This will enable the exit animation to work as intended per the Motion library requirements.

components/figma-header.tsx (2)

10-10: LGTM! Import correctly adds AnimatePresence.

The import change properly adds AnimatePresence to enable exit animations for the mobile menu, consistent with the changes in components/home/header.tsx.


80-110: LGTM! AnimatePresence wrapper correctly enables exit animations.

The mobile menu implementation properly wraps the conditional rendering with AnimatePresence and uses a motion.div with matching initial and exit states. This enables smooth exit animations as required by the Motion library. The simplified mobile menu with the GitHub link works correctly.

Comment on lines +156 to +159
onClick={(e) => {
handleScrollToSection(e);
setMobileMenuOpen(false);
}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix navigation bug: Conditionally call handleScrollToSection.

The onClick handler unconditionally calls handleScrollToSection for all menu items, but this breaks the "/pricing" link because handleScrollToSection calls e.preventDefault(). The desktop version (line 79) correctly calls handleScrollToSection only for hash links.

🔎 Apply this diff to fix the navigation bug:
                  onClick={(e) => {
-                   handleScrollToSection(e);
+                   if (item.href.startsWith("#")) {
+                     handleScrollToSection(e);
+                   }
                    setMobileMenuOpen(false);
                  }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onClick={(e) => {
handleScrollToSection(e);
setMobileMenuOpen(false);
}}
onClick={(e) => {
if (item.href.startsWith("#")) {
handleScrollToSection(e);
}
setMobileMenuOpen(false);
}}
🤖 Prompt for AI Agents
In components/home/header.tsx around lines 156 to 159, the onClick handler
currently always calls handleScrollToSection which prevents navigation for
normal links (e.g. /pricing); change it to first read the clicked link's href
(e.g. const href = (e.currentTarget as HTMLAnchorElement).getAttribute('href'))
and only call handleScrollToSection(e) when href is a hash link
(startsWith('#')); always call setMobileMenuOpen(false) afterwards so the menu
still closes for all links.

}}
className="group relative overflow-hidden py-2 text-sm font-medium"
>
<span className="relative z-10">{item.href}</span>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix critical bug: Display label instead of href.

Line 162 displays item.href instead of item.label, which would show technical values like "#examples" or "/pricing" instead of user-friendly labels like "Examples" or "Pricing".

🔎 Apply this diff to fix the display bug:
-                  <span className="relative z-10">{item.href}</span>
+                  <span className="relative z-10">{item.label}</span>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span className="relative z-10">{item.href}</span>
<span className="relative z-10">{item.label}</span>
🤖 Prompt for AI Agents
In components/home/header.tsx around line 162 the span currently renders
item.href which shows raw route values; change it to render the human-facing
item.label (e.g., replace item.href with item.label), optionally using a safe
fallback like item.label || item.href to avoid breaking if label is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant