MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / useSearchProps

Function useSearchProps

apps/baseai.dev/src/components/Search.tsx:435–460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

SearchFunction · 0.85
MobileSearchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected