Skip to content

style(navbar): rotate dropdown icons when menu is open#5230

Open
Dsp023 wants to merge 1 commit intoasyncapi:masterfrom
Dsp023:fix/issue-4984-navbar-chevron
Open

style(navbar): rotate dropdown icons when menu is open#5230
Dsp023 wants to merge 1 commit intoasyncapi:masterfrom
Dsp023:fix/issue-4984-navbar-chevron

Conversation

@Dsp023
Copy link

@Dsp023 Dsp023 commented Mar 9, 2026

This PR rotates the navigation dropdown icons (chevrons) by 180 degrees when the menu is active/open to clearly signal the menu state.

Closes #4984

Changes made:

  • Updated NavItemDropdown component to accept an isOpen prop and apply a -rotate-180 Tailwind class when true.
  • Updated NavItem to accept and pass down the isOpen prop to the dropdown icon.
  • Updated NavBar.tsx and MobileNavMenu.tsx to pass the active state (isOpen={open === '<menu>'}) down to the NavItem and NavItemDropdown components.

Summary by CodeRabbit

  • Improvements
    • Navigation dropdown indicators now dynamically rotate to visually reflect when menu sections are open or closed. This enhancement provides clearer visual feedback across all navigation menus, improving user experience and navigation clarity throughout the interface.

@netlify
Copy link

netlify bot commented Mar 9, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9aaf236
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/69aeb87c39fd1800085396d3
😎 Deploy Preview https://deploy-preview-5230--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

The pull request threads an isOpen boolean prop through the navigation component hierarchy (NavBar → NavItem → NavItemDropdown) to enable dropdown icons to rotate 180 degrees when their corresponding menu sections are open, replacing static icon rendering with state-driven visual feedback.

Changes

Cohort / File(s) Summary
Dropdown Icon Rotation State
components/icons/NavItemDropdown.tsx, components/navigation/NavItem.tsx
Added isOpen?: boolean prop to both components. NavItemDropdown applies -rotate-180 CSS transformation when open; NavItem threads the prop through to NavItemDropdown in both link and button rendering paths.
Menu State Propagation
components/navigation/NavBar.tsx, components/navigation/MobileNavMenu.tsx
NavBar sets isOpen prop on NavItem instances based on active menu section (learning, tooling, community). MobileNavMenu passes isOpen state to NavItemDropdown components conditionally, replacing unconditional rendering.

Sequence Diagram

sequenceDiagram
    participant User
    participant NavBar
    participant NavItem
    participant NavItemDropdown

    User->>NavBar: Hover on "Learning" menu
    NavBar->>NavBar: Update state: open = 'learning'
    NavBar->>NavItem: Render with isOpen={true}
    NavItem->>NavItemDropdown: Pass isOpen={true}
    NavItemDropdown->>NavItemDropdown: Apply className with -rotate-180
    NavItemDropdown-->>User: Icon rotated 180°

    User->>NavBar: Move mouse away
    NavBar->>NavBar: Update state: open = null
    NavBar->>NavItem: Render with isOpen={false}
    NavItem->>NavItemDropdown: Pass isOpen={false}
    NavItemDropdown->>NavItemDropdown: Remove rotation
    NavItemDropdown-->>User: Icon rotated back to original
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 When dropdowns dance and icons spin,
A little twirl to let menus in,
No longer rigid, now they sway,
The arrow points the perfect way!
Open wide, rotate with glee,
UI flow, as it should be!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The pull request fully implements the requirement from issue #4984 to rotate dropdown icons 180° when menus are open by adding the isOpen prop and applying the -rotate-180 Tailwind class to affected components.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the dropdown icon rotation feature; no unrelated modifications to package.json or other non-navbar components are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly and concisely describes the main change: rotating dropdown icons when the menu is open, which directly matches the core functionality added across all modified components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5825299) to head (9aaf236).
⚠️ Report is 54 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5230   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          796       796           
  Branches       146       146           
=========================================
  Hits           796       796           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asyncapi-bot
Copy link
Contributor

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 36
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-5230--asyncapi-website.netlify.app/

Copy link
Contributor

@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.

🧹 Nitpick comments (1)
components/navigation/NavItem.tsx (1)

25-26: Consider documenting the isOpen prop in JSDoc.

The new isOpen prop is not documented in the component's JSDoc comment.

Suggested addition
  * `@param` {boolean} [props.hasDropdown=false] - Indicates if the navigation item has a dropdown menu.
+ * `@param` {boolean} [props.isOpen=false] - Indicates if the dropdown menu is currently open.
  * `@param` {string} [props.className=''] - Additional CSS classes for styling.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/navigation/NavItem.tsx` around lines 25 - 26, Add a JSDoc `@param`
entry for the new boolean prop isOpen on the NavItem component so it appears in
the component's JSDoc (e.g., the NavItem props block or Props interface).
Document its type (boolean), default value (false), and brief purpose such as
"controls whether the dropdown/menu is open (controlled)". Ensure the param name
matches exactly "isOpen" so tools pick it up alongside existing props like
hasDropdown and className.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/navigation/NavItem.tsx`:
- Around line 25-26: Add a JSDoc `@param` entry for the new boolean prop isOpen on
the NavItem component so it appears in the component's JSDoc (e.g., the NavItem
props block or Props interface). Document its type (boolean), default value
(false), and brief purpose such as "controls whether the dropdown/menu is open
(controlled)". Ensure the param name matches exactly "isOpen" so tools pick it
up alongside existing props like hasDropdown and className.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f8db256-f122-4c6c-8e8b-bcfeedccfaed

📥 Commits

Reviewing files that changed from the base of the PR and between d18eca0 and 9aaf236.

📒 Files selected for processing (4)
  • components/icons/NavItemDropdown.tsx
  • components/navigation/MobileNavMenu.tsx
  • components/navigation/NavBar.tsx
  • components/navigation/NavItem.tsx

@Dsp023 Dsp023 changed the title design(navbar): rotate dropdown icons when menu is open style(navbar): rotate dropdown icons when menu is open Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

[DESIGN]: Navbar dropdown icons should rotate when menu is open

2 participants