1
1
import { lazy , Suspense , useRef } from "react"
2
2
import { useTranslation } from "next-i18next"
3
- import { MdSearch } from "react-icons/md"
4
3
5
4
import { EthHomeIcon } from "@/components/icons"
6
5
import Search from "@/components/Search"
7
6
8
7
import { isDesktop } from "@/lib/utils/isDesktop"
9
8
10
9
import SearchButton from "../Search/SearchButton"
11
- import { Button } from "../ui/buttons/Button "
10
+ import SearchInputButton from "../Search/SearchInputButton "
12
11
import { BaseLink } from "../ui/Link"
13
12
14
13
import DesktopNavMenu from "./Desktop"
15
14
import Menu from "./Menu"
16
15
import { useNav } from "./useNav"
17
16
18
- import { useDisclosure } from "@/hooks/useDisclosure"
19
17
import { useIsClient } from "@/hooks/useIsClient"
20
18
21
19
const MobileNavMenu = lazy ( ( ) => import ( "./Mobile" ) )
@@ -24,7 +22,6 @@ const MobileNavMenu = lazy(() => import("./Mobile"))
24
22
const Nav = ( ) => {
25
23
const { toggleColorMode, linkSections } = useNav ( )
26
24
const { t } = useTranslation ( "common" )
27
- const searchModalDisclosure = useDisclosure ( )
28
25
const navWrapperRef = useRef ( null )
29
26
const isClient = useIsClient ( )
30
27
const isDesktopFlag = isDesktop ( )
@@ -53,36 +50,34 @@ const Nav = () => {
53
50
< div />
54
51
) }
55
52
56
- < div className = "flex items-center" >
57
- { /* Desktop */ }
58
- < div className = "hidden md:flex" >
59
- < Search { ...searchModalDisclosure } >
60
- < SearchButton />
61
- </ Search >
62
- < DesktopNavMenu toggleColorMode = { toggleColorMode } />
63
- </ div >
53
+ < Search >
54
+ { ( { onOpen } ) => (
55
+ < div className = "flex items-center" >
56
+ { /* Desktop */ }
57
+ < div className = "hidden md:flex" >
58
+ < SearchButton className = "xl:hidden" onClick = { onOpen } />
59
+ < SearchInputButton
60
+ className = "hidden xl:flex"
61
+ onClick = { onOpen }
62
+ />
63
+ < DesktopNavMenu toggleColorMode = { toggleColorMode } />
64
+ </ div >
64
65
65
- < div className = "flex md:hidden" >
66
- { /* Mobile */ }
67
- { /* use Suspense to display the Search & the Menu at the same time */ }
68
- < Suspense >
69
- < Search { ...searchModalDisclosure } >
70
- < Button
71
- className = "px-2 transition-transform duration-200 ease-in-out hover:rotate-6 hover:text-primary"
72
- variant = "ghost"
73
- isSecondary
74
- >
75
- < MdSearch />
76
- </ Button >
77
- </ Search >
78
- < MobileNavMenu
79
- toggleColorMode = { toggleColorMode }
80
- linkSections = { linkSections }
81
- toggleSearch = { searchModalDisclosure . onOpen }
82
- />
83
- </ Suspense >
84
- </ div >
85
- </ div >
66
+ < div className = "flex md:hidden" >
67
+ { /* Mobile */ }
68
+ { /* use Suspense to display the Search & the Menu at the same time */ }
69
+ < Suspense >
70
+ < SearchButton onClick = { onOpen } />
71
+ < MobileNavMenu
72
+ toggleColorMode = { toggleColorMode }
73
+ linkSections = { linkSections }
74
+ toggleSearch = { onOpen }
75
+ />
76
+ </ Suspense >
77
+ </ div >
78
+ </ div >
79
+ ) }
80
+ </ Search >
86
81
</ div >
87
82
</ div >
88
83
</ nav >
0 commit comments