|
1 | 1 | import { DocSearchModal, useDocSearchKeyboardEvents } from '@docsearch/react' |
2 | | -import { SearchIcon } from '@heroicons/react/outline' |
3 | 2 | import Head from 'next/head' |
4 | 3 | import Link from 'next/link' |
5 | 4 | import { useRouter } from 'next/router' |
6 | 5 | import { useCallback, useEffect, useRef, useState } from 'react' |
7 | 6 | import { createPortal } from 'react-dom' |
| 7 | +import SearchIcon from '@/components/icons/SearchIcon' |
8 | 8 |
|
9 | 9 | const ACTION_KEY_DEFAULT = ['Ctrl ', 'Control'] |
10 | 10 | const ACTION_KEY_APPLE = ['⌘', 'Command'] |
@@ -69,16 +69,19 @@ export function Search() { |
69 | 69 | type="button" |
70 | 70 | ref={searchButtonRef} |
71 | 71 | onClick={onOpen} |
72 | | - className="group flex w-full items-center space-x-3 rounded-md border-2 border-gray-200 bg-gray-100 py-1.5 px-1.5 font-medium leading-6 text-gray-500 hover:text-gray-600 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 sm:space-x-4 sm:px-4 lg:px-4" |
| 72 | + className="group flex w-full items-center justify-between rounded-full border-2 border-gray-200 py-1.5 px-1.5 font-medium leading-6 text-gray-500 shadow-inner hover:text-gray-600 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 sm:space-x-4 sm:rounded-md sm:px-4 lg:px-4" |
73 | 73 | > |
74 | | - <SearchIcon className="h-6 w-6 text-blue-400 transition-colors duration-200 group-hover:text-blue-500" /> |
75 | | - <span> |
76 | | - <span className="md:hidden lg:hidden">Search</span> |
77 | | - <span className="hidden sm:inline">Quick search for anything</span> |
78 | | - </span> |
| 74 | + <div className="flex items-center justify-start"> |
| 75 | + <SearchIcon className="h-6 w-6 text-blue-400 transition-colors duration-200 group-hover:text-blue-500" /> |
| 76 | + <span className={router.pathname === '/' ? 'sm:ml-2' : 'ml-2'}> |
| 77 | + <span className="sm:hidden lg:hidden">{router.pathname === '/' ? '' : 'Search'}</span> |
| 78 | + <span className="hidden sm:inline">Quick search for anything</span> |
| 79 | + </span> |
| 80 | + </div> |
| 81 | + |
79 | 82 | <span |
80 | 83 | style={{ opacity: browserDetected ? '1' : '0' }} |
81 | | - className="hidden rounded-md border border-gray-400 py-0.5 px-1.5 text-sm leading-5 text-gray-500 sm:block" |
| 84 | + className="hidden justify-end rounded-md border border-gray-400 py-0.5 px-1.5 text-sm leading-5 text-gray-500 sm:block" |
82 | 85 | > |
83 | 86 | <span className="sr-only">Press </span> |
84 | 87 | <kbd className="font-sans"> |
@@ -107,6 +110,7 @@ export function Search() { |
107 | 110 | }, |
108 | 111 | }} |
109 | 112 | hitComponent={Hit} |
| 113 | + hitsPerPage={10} |
110 | 114 | transformItems={(items) => { |
111 | 115 | return items.map((item) => { |
112 | 116 | // We transform the absolute URL into a relative URL to |
|
0 commit comments