MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / useSearchProps

Function useSearchProps

src/components/Search.tsx:431–456  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

429}
430
431function useSearchProps() {
432 let buttonRef = useRef<React.ElementRef<'button'>>(null)
433 let [open, setOpen] = useState(false)
434
435 return {
436 buttonProps: {
437 ref: buttonRef,
438 onClick() {
439 setOpen(true)
440 },
441 },
442 dialogProps: {
443 open,
444 setOpen: useCallback(
445 (open: boolean) => {
446 let { width = 0, height = 0 } =
447 buttonRef.current?.getBoundingClientRect() ?? {}
448 if (!open || (width !== 0 && height !== 0)) {
449 setOpen(open)
450 }
451 },
452 [setOpen],
453 ),
454 },
455 }
456}
457
458export function Search() {
459 let [modifierKey, setModifierKey] = useState<string>()

Callers 2

SearchFunction · 0.85
MobileSearchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected