|
3 | 3 | import { Dialog, Transition } from '@headlessui/react'; |
4 | 4 | import Link from 'next/link'; |
5 | 5 | import { usePathname, useSearchParams } from 'next/navigation'; |
6 | | -import { Fragment, useEffect, useState } from 'react'; |
| 6 | +import { Fragment, Suspense, useEffect, useState } from 'react'; |
7 | 7 |
|
8 | 8 | import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline'; |
9 | 9 | import { Menu } from 'lib/shopify/types'; |
10 | | -import Search from './search'; |
| 10 | +import Search, { SearchSkeleton } from './search'; |
11 | 11 |
|
12 | 12 | export default function MobileMenu({ menu }: { menu: Menu[] }) { |
13 | 13 | const pathname = usePathname(); |
@@ -35,7 +35,7 @@ export default function MobileMenu({ menu }: { menu: Menu[] }) { |
35 | 35 | <button |
36 | 36 | onClick={openMobileMenu} |
37 | 37 | aria-label="Open mobile menu" |
38 | | - className="flex h-11 w-11 items-center justify-center rounded-md border border-neutral-200 text-black transition-colors dark:border-neutral-700 dark:text-white md:hidden" |
| 38 | + className="flex h-11 w-11 items-center justify-center rounded-md border border-neutral-200 text-black transition-colors md:hidden dark:border-neutral-700 dark:text-white" |
39 | 39 | > |
40 | 40 | <Bars3Icon className="h-4" /> |
41 | 41 | </button> |
@@ -72,7 +72,9 @@ export default function MobileMenu({ menu }: { menu: Menu[] }) { |
72 | 72 | </button> |
73 | 73 |
|
74 | 74 | <div className="mb-4 w-full"> |
75 | | - <Search /> |
| 75 | + <Suspense fallback={<SearchSkeleton />}> |
| 76 | + <Search /> |
| 77 | + </Suspense> |
76 | 78 | </div> |
77 | 79 | {menu.length ? ( |
78 | 80 | <ul className="flex w-full flex-col"> |
|
0 commit comments