* initial implementation of search modal * added hit and search suggestions * added support for multiple indices * updated sample env * added close when click outside dropdown * test for mobile * added mobile design * added shortcut * dark mode fixes * added search to docs * added plugins filter * added React import * moved filters to configurations * handled error on page load * change suggestion text * removed hits limit * handle select all * open link in current tab * change highlight colors * added support for shortcuts + auto focus * change header and footer * redesigned search ui
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
"use client"
|
|
|
|
import NavbarIconButton, { NavbarIconButtonProps } from "../IconButton"
|
|
import { useSidebar } from "@/providers/sidebar"
|
|
import IconSidebar from "../../Icons/Sidebar"
|
|
import clsx from "clsx"
|
|
import IconXMark from "../../Icons/XMark"
|
|
import { usePageLoading } from "../../../providers/page-loading"
|
|
|
|
type NavbarMenuButtonProps = {
|
|
buttonProps?: NavbarIconButtonProps
|
|
}
|
|
|
|
const NavbarMenuButton = ({ buttonProps }: NavbarMenuButtonProps) => {
|
|
const { setMobileSidebarOpen, mobileSidebarOpen } = useSidebar()
|
|
const { isLoading } = usePageLoading()
|
|
|
|
return (
|
|
<NavbarIconButton
|
|
{...buttonProps}
|
|
className={clsx("mr-1 lg:!hidden", buttonProps?.className)}
|
|
onClick={() => {
|
|
if (!isLoading) {
|
|
setMobileSidebarOpen((prevValue) => !prevValue)
|
|
}
|
|
}}
|
|
>
|
|
{!mobileSidebarOpen && (
|
|
<IconSidebar iconColorClassName="stroke-medusa-fg-muted dark:stroke-medusa-fg-muted-dark" />
|
|
)}
|
|
{mobileSidebarOpen && (
|
|
<IconXMark iconColorClassName="stroke-medusa-fg-muted dark:stroke-medusa-fg-muted-dark" />
|
|
)}
|
|
</NavbarIconButton>
|
|
)
|
|
}
|
|
|
|
export default NavbarMenuButton
|