Skip to content

Commit

Permalink
fix: extra button behaviour in navbar (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
braianj authored Nov 21, 2024
1 parent 80dff04 commit 7c48103
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Navbar/MainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const MainMenu = (props: MainMenuProps) => {
mainUrl={extraButton.link}
textColor={extraButton.textColor}
backgroundColor={extraButton.backgroundColor}
isExtraButton
/>
) : null}
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/components/Navbar/MenuItem/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const MenuItem = (props: MenuItemProps) => {
isMobile,
mainUrl,
textColor,
backgroundColor
backgroundColor,
isExtraButton
} = props

const mainRedirect = useCallback(() => {
Expand All @@ -27,7 +28,9 @@ export const MenuItem = (props: MenuItemProps) => {
<Menu.Item
active={activePage === section}
onClick={(e: React.MouseEvent) => {
isMobile ? onToggleShowSubMenu(e, true, section) : mainRedirect()
isMobile && !isExtraButton
? onToggleShowSubMenu(e, true, section)
: mainRedirect()
}}
onMouseEnter={(e: React.MouseEvent) =>
!isMobile && onToggleShowSubMenu(e, true, section)
Expand Down
1 change: 1 addition & 0 deletions src/components/Navbar/MenuItem/MenuItem.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type MenuItemProps = {
) => void
mainUrl?: string
isMobile?: boolean
isExtraButton?: boolean
textColor?: string
backgroundColor?: string
}

0 comments on commit 7c48103

Please sign in to comment.