From 287c65a5c7c45440fa33478777446cdf3756ef1a Mon Sep 17 00:00:00 2001 From: Peterl561 Date: Tue, 7 Jan 2025 14:06:09 +0800 Subject: [PATCH 1/2] fix(navbar): remove NavbarMenu when closed --- .../components/navbar/src/navbar-menu.tsx | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/packages/components/navbar/src/navbar-menu.tsx b/packages/components/navbar/src/navbar-menu.tsx index 382e856367..367a0b2e41 100644 --- a/packages/components/navbar/src/navbar-menu.tsx +++ b/packages/components/navbar/src/navbar-menu.tsx @@ -32,25 +32,28 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => { const styles = clsx(classNames?.menu, className); - // only apply overlay when menu is open - const OverlayComponent = isMenuOpen ? Overlay : React.Fragment; + if (disableAnimation) { + if (!isMenuOpen) return null; - const contents = disableAnimation ? ( - - - - ) : ( + return ( + + + + ); + } + + return ( {isMenuOpen ? ( @@ -78,8 +81,6 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => { ) : null} ); - - return contents; }); NavbarMenu.displayName = "NextUI.NavbarMenu"; From a40bc9598a0e65b472de018a9d97ae809d789eac Mon Sep 17 00:00:00 2001 From: Peterl561 Date: Tue, 7 Jan 2025 14:06:17 +0800 Subject: [PATCH 2/2] chore(changeset): fixed NavbarMenu console prop error --- .changeset/nice-beds-battle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nice-beds-battle.md diff --git a/.changeset/nice-beds-battle.md b/.changeset/nice-beds-battle.md new file mode 100644 index 0000000000..14810f74bb --- /dev/null +++ b/.changeset/nice-beds-battle.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/navbar": patch +--- + +fixed NavbarMenu React.Fragment prop error when animation is disabled (#4501)