Skip to content

Commit

Permalink
👍 fix: adding auto close event when the path change
Browse files Browse the repository at this point in the history
  • Loading branch information
nyomansunima committed Oct 31, 2023
1 parent 45cf90e commit 8f1a4dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/components/common/dynamic-logo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'

import Image from 'next/image'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import * as React from 'react'
Expand Down
9 changes: 9 additions & 0 deletions src/components/common/navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ import { Button } from '@components/ui/button'
import { Sheet, SheetContent } from '@components/ui/sheet'
import { Tooltip, TooltipContent, TooltipTrigger } from '@components/ui/tooltip'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import * as React from 'react'
import { sideNavMenus } from '~/constants/menu'
import { socials } from '~/constants/social'

export function NavigationMenu() {
const pathname = usePathname()
const [isOpen, setOpen] = React.useState<boolean>(false)

React.useEffect(
function closeSheetOnPathChange() {
setOpen(false)
},
[pathname],
)

return (
<>
<Tooltip>
Expand Down

0 comments on commit 8f1a4dc

Please sign in to comment.