From fcd33b75952565897500e215b3054cf10c341cc3 Mon Sep 17 00:00:00 2001 From: Nounspace Ryan Date: Mon, 29 Jul 2024 10:56:56 -0500 Subject: [PATCH] feat: add search to navigation, refactor nav items, update icons --- .../components/organisms/Navigation.tsx | 181 ++++++++++++++---- 1 file changed, 139 insertions(+), 42 deletions(-) diff --git a/src/common/components/organisms/Navigation.tsx b/src/common/components/organisms/Navigation.tsx index 93e31de4..be7facc8 100644 --- a/src/common/components/organisms/Navigation.tsx +++ b/src/common/components/organisms/Navigation.tsx @@ -1,4 +1,10 @@ -import React, { useCallback, useEffect, useMemo, useState } from "react"; +import React, { + useCallback, + useEffect, + useMemo, + useState, + useRef, +} from "react"; import { mergeClasses } from "@/common/lib/utils/mergeClasses"; import BrandHeader from "../molecules/BrandHeader"; import Player from "@/common/components/organisms/Player"; @@ -19,12 +25,13 @@ import { AnalyticsEvent, analytics, } from "@/common/providers/AnalyticsProvider"; +import SearchModal from "@/common/components/organisms/SearchModal"; type NavItemProps = { label: string; active?: boolean; Icon: React.FC; - href: string; + href?: string; disable?: boolean; openInNewTab?: boolean; onClick?: () => void; @@ -41,6 +48,7 @@ const Navigation: React.FC = ({ enterEditMode, theme: userTheme, }) => { + const searchRef = useRef(null); const { setModalOpen, getIsLoggedIn, getIsInitializing } = useAppStore( (state) => ({ setModalOpen: state.setup.setModalOpen, @@ -113,6 +121,34 @@ const Navigation: React.FC = ({ ); }; + const NavButton: React.FC = ({ + label, + Icon, + href, + onClick, + disable = false, + openInNewTab = false, + }) => { + return ( +
  • + +
  • + ); + }; + + const openSearchModal = useCallback(() => { + if (!searchRef?.current) return; + searchRef.current.focus(); + }, [searchRef]); + return (