Skip to content

Commit

Permalink
fixes asyncapi#3371 algolia search button for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
jyotishpro committed Nov 16, 2024
1 parent 28fed46 commit 2cadadf
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions components/navigation/MobileNavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ export default function MobileNavMenu({ onClickClose = () => {} }: MobileNavMenu
setOpen(menu);
}

const loupeSvg = encodeURIComponent(`
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
stroke="#9CA3AF"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m19 19-3.5-3.5" />
<circle cx="11" cy="11" r="6" />
</svg>
`);

return (
<div className='fixed inset-x-0 top-0 z-60 max-h-full origin-top-right overflow-y-auto py-2 transition lg:hidden'>
<div className='rounded-lg shadow-lg'>
Expand All @@ -52,10 +69,16 @@ export default function MobileNavMenu({ onClickClose = () => {} }: MobileNavMenu
</Link>
<div className='justify-content -mr-2 flex flex-row items-center' data-testid='MobileNav-button'>
<SearchButton
className='flex items-center space-x-2 rounded-md p-2 text-left text-gray-400 transition duration-150 ease-in-out hover:bg-gray-100 hover:text-gray-500 focus:bg-gray-100 focus:text-gray-500 focus:outline-none'
className='flex items-center space-x-2 rounded-md p-4 text-left text-gray-400 transition duration-150 ease-in-out hover:bg-gray-100 hover:text-gray-500 focus:bg-gray-100 focus:text-gray-500 focus:outline-none'
aria-label='Open Search'
style={{
backgroundImage: `url("data:image/svg+xml;charset=utf-8,${loupeSvg}")`,
backgroundSize: '1.5rem',
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center left',
}}
>
<SearchIcon />

</SearchButton>
<button
onClick={onClickClose}
Expand Down

0 comments on commit 2cadadf

Please sign in to comment.