Skip to content

Commit

Permalink
fix(navbar): allow height prop to accept number type and fix broken m…
Browse files Browse the repository at this point in the history
…enu (#3601)

* fix(navbar): allow height prop to accept number type and fix broken menu

* fix(navbar): menu breaking when a numerical height value is provided. changeset
  • Loading branch information
FacundoTenuta committed Aug 29, 2024
1 parent 3c0a486 commit 048de6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-clouds-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/navbar": patch
---

Fix navbar menu breaking when a numerical height value is provided. The height value is now converted to pixels if it is a number.
4 changes: 2 additions & 2 deletions packages/components/navbar/src/navbar-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => {
data-open={dataAttr(isMenuOpen)}
style={{
// @ts-expect-error
"--navbar-height": height,
"--navbar-height": typeof height === "number" ? `${height}px` : height,
}}
{...otherProps}
>
Expand All @@ -72,7 +72,7 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => {
initial="exit"
style={{
// @ts-expect-error
"--navbar-height": height,
"--navbar-height": typeof height === "number" ? `${height}px` : height,
...style,
}}
variants={menuVariants}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/navbar/src/use-navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export function useNavbar(originalProps: UseNavbarProps) {
ref: domRef,
className: slots.base({class: clsx(baseStyles, props?.className)}),
style: {
"--navbar-height": height,
"--navbar-height": typeof height === "number" ? `${height}px` : height,
...otherProps?.style,
...props?.style,
},
Expand Down

0 comments on commit 048de6e

Please sign in to comment.