File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11"use client" ;
2+
23import { useSearchContext } from "fumadocs-ui/contexts/search" ;
34import { shortcutLabel } from "lib/utils/is-mac-like" ;
45import { Search , SearchIcon } from "lucide-react" ;
5- import type { ComponentProps } from "react" ;
6+ import { useEffect , useState , type ComponentProps } from "react" ;
67
78export function SearchToggle ( props : ComponentProps < "div" > ) {
89 const { enabled, setOpenSearch } = useSearchContext ( ) ;
10+ const [ shortcut , setShortcut ] = useState ( " " ) ;
11+
12+ useEffect ( ( ) => {
13+ setShortcut ( shortcutLabel ( ) )
14+ } , [ ] )
15+
916 if ( ! enabled ) return ;
1017
1118 return (
@@ -34,7 +41,7 @@ export function SearchToggle(props: ComponentProps<"div">) {
3441 </ div >
3542 < div className = "px-1.5 py-[3px] bg-muted rounded-xs outline outline-[0.50px] outline-offset-[-0.50px] outline-zinc-800 inline-flex justify-center items-center" >
3643 < div className = "text-center justify-center text-zinc-500 text-xs font-normal font-mono leading-none group-hover:text-primary" >
37- { shortcutLabel ( ) || " " }
44+ { shortcut }
3845 </ div >
3946 </ div >
4047 </ div >
You can’t perform that action at this time.
0 commit comments