From 92f14cef7ba6a23411d73d526f5e27851f47ba00 Mon Sep 17 00:00:00 2001 From: nounspaceryan Date: Mon, 29 Jul 2024 15:27:16 -0500 Subject: [PATCH] User Search (#284) --- src/common/components/atoms/command.tsx | 2 +- .../components/organisms/Navigation.tsx | 205 +++++++++++++----- .../organisms/SearchAutocompleteInput.tsx | 110 ++++++++++ .../components/organisms/SearchModal.tsx | 50 +++++ src/common/lib/hooks/useSearchUsers.ts | 83 +++++++ src/pages/api/search/users.ts | 161 ++++++++++++++ tailwind.config.js | 31 +++ 7 files changed, 592 insertions(+), 50 deletions(-) create mode 100644 src/common/components/organisms/SearchAutocompleteInput.tsx create mode 100644 src/common/components/organisms/SearchModal.tsx create mode 100644 src/common/lib/hooks/useSearchUsers.ts create mode 100644 src/pages/api/search/users.ts diff --git a/src/common/components/atoms/command.tsx b/src/common/components/atoms/command.tsx index bf0626d6..ba829dba 100644 --- a/src/common/components/atoms/command.tsx +++ b/src/common/components/atoms/command.tsx @@ -41,7 +41,7 @@ const CommandInput = React.forwardRef< React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => (
- + void; }; +type NavButtonProps = Omit; + type NavProps = { isEditable: boolean; enterEditMode: () => void; }; const Navigation: React.FC = ({ isEditable, enterEditMode }) => { + const searchRef = useRef(null); const { setModalOpen, getIsLoggedIn, getIsInitializing } = useAppStore( (state) => ({ setModalOpen: state.setup.setModalOpen, @@ -107,6 +109,33 @@ const Navigation: React.FC = ({ isEditable, enterEditMode }) => { ); }; + const NavButton: React.FC = ({ + label, + Icon, + onClick, + disable = false, + }) => { + return ( +
  • + +
  • + ); + }; + + const openSearchModal = useCallback(() => { + if (!searchRef?.current) return; + searchRef.current.focus(); + }, [searchRef]); + return (