Skip to content

Conversation

@Kenzo-Wada
Copy link
Contributor

@Kenzo-Wada Kenzo-Wada commented Sep 25, 2025

sidebar should close on navigation when using smartphones

Summary by CodeRabbit

  • New Features
    • Side navigation now auto-closes when a link is selected from the hamburger menu, streamlining navigation on mobile and small screens.
    • Improved user flow by allowing the menu to close immediately after choosing a destination, reducing extra taps.
  • Documentation
    • Clarified behavior of the side navigation when used within the hamburger menu context.

@vercel
Copy link

vercel bot commented Sep 25, 2025

@Kenzo-Wada is attempting to deploy a commit to the Retro UI Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

SideNav now accepts an optional setIsOpen prop. HamburgerMenu passes its isOpen state setter to SideNav. SideNav invokes setIsOpen(false) on link clicks to close the menu. Minor JSX restructuring and formatting were applied without other behavioral changes.

Changes

Cohort / File(s) Summary of changes
SideNav API update
components/SideNav.tsx
Added SideNavProps with optional setIsOpen. Converted component to accept props. Added onClick on each Link to call setIsOpen(false) when provided. Minor JSX restructuring and formatting. Export signature updated accordingly.
HamburgerMenu integration
components/HamburgerMenu.tsx
Passed setIsOpen from HamburgerMenu to SideNav to allow SideNav to close the menu on navigation. No other logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant HM as HamburgerMenu
  participant SN as SideNav
  participant State as isOpen State

  Note over HM: Renders SideNav with prop setIsOpen
  HM->>SN: render SideNav({ setIsOpen })
  User->>SN: Click nav Link
  alt setIsOpen provided
    SN->>State: setIsOpen(false)
    State-->>HM: isOpen = false
    HM-->>User: Menu closes
  else no setIsOpen
    SN-->>User: Navigate (menu state unchanged)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A nibble of links, a hop through the UI,
I boop a button—whoosh! menus comply.
SideNav whispers, “close now, please,”
Hamburger hums and folds with ease.
In burrows of state where callbacks play,
I thump approval—ship it today! 🐇✨

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 succinctly identifies the bug being addressed—preventing the sidebar from remaining open after navigation—which aligns directly with the code changes and the PR description. It is concise, specific, and avoids unnecessary detail or noise.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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
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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/SideNav.tsx (1)

3-13: Type setIsOpen as React’s Dispatch for future-proofing functional updates.

Wiring the sidebar’s close handler through a prop looks good, but the current (isOpen: boolean) => void signature is narrower than the useState setter you’re passing from HamburgerMenu. Typing it as Dispatch<SetStateAction<boolean>> keeps it compatible with functional updates (e.g., setIsOpen?.((prev) => !prev)), which React may need down the line.

+import type { Dispatch, SetStateAction } from "react";
 import { navConfig } from "@/config/navigation";
 import { Badge, Text } from "@/components/retroui";
 import Link from "next/link";
 import { usePathname } from "next/navigation";
 
 interface SideNavProps {
-  setIsOpen?: (isOpen: boolean) => void;
+  setIsOpen?: Dispatch<SetStateAction<boolean>>;
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3ff897 and 4576fb2.

📒 Files selected for processing (2)
  • components/HamburgerMenu.tsx (1 hunks)
  • components/SideNav.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/HamburgerMenu.tsx (1)
components/SideNav.tsx (1)
  • SideNav (12-53)
components/SideNav.tsx (1)
components/retroui/Badge.tsx (1)
  • Badge (29-44)
🔇 Additional comments (1)
components/HamburgerMenu.tsx (1)

33-36: LGTM: Propagating the setter keeps the menu state in one place.

Passing the setIsOpen dispatch straight through lets SideNav close the drawer without duplicating state. Nicely scoped change.

@vercel
Copy link

vercel bot commented Sep 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
retro-ui Ready Ready Preview Comment Sep 25, 2025 6:12am

@ariflogs ariflogs merged commit 6e8b9db into Logging-Studio:main Sep 25, 2025
3 checks passed
@ariflogs
Copy link
Member

Thank you for the contribution 🙏

@Kenzo-Wada Kenzo-Wada deleted the fix/sidebar-state-sp branch September 25, 2025 06:24
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.

2 participants