[WEB-5569] chore: top nav search enhancements (#8226)
* chore: top nav power k search menu enhancements * chore: expandable search panel refactor
This commit is contained in:
parent
b8a41ad5a0
commit
105ac5ece5
4 changed files with 33 additions and 7 deletions
|
|
@ -272,6 +272,7 @@ export const TopNavPowerK = observer(() => {
|
|||
isWorkspaceLevel={isWorkspaceLevel}
|
||||
searchTerm={searchTerm}
|
||||
setSearchTerm={setSearchTerm}
|
||||
handleSearchMenuClose={() => closePanel()}
|
||||
/>
|
||||
</Command.List>
|
||||
<PowerKModalFooter
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export type TPowerKCommandsListProps = {
|
|||
isWorkspaceLevel: boolean;
|
||||
searchTerm: string;
|
||||
setSearchTerm: (value: string) => void;
|
||||
handleSearchMenuClose?: () => void;
|
||||
};
|
||||
|
||||
export function ProjectsAppPowerKCommandsList(props: TPowerKCommandsListProps) {
|
||||
|
|
@ -22,6 +23,7 @@ export function ProjectsAppPowerKCommandsList(props: TPowerKCommandsListProps) {
|
|||
isWorkspaceLevel,
|
||||
searchTerm,
|
||||
setSearchTerm,
|
||||
handleSearchMenuClose,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
|
|
@ -32,6 +34,7 @@ export function ProjectsAppPowerKCommandsList(props: TPowerKCommandsListProps) {
|
|||
isWorkspaceLevel={!context.params.projectId || isWorkspaceLevel}
|
||||
searchTerm={searchTerm}
|
||||
updateSearchTerm={setSearchTerm}
|
||||
handleSearchMenuClose={handleSearchMenuClose}
|
||||
/>
|
||||
<PowerKContextBasedPagesList
|
||||
activeContext={context.activeContext}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,11 @@ type Props = {
|
|||
isWorkspaceLevel: boolean;
|
||||
searchTerm: string;
|
||||
updateSearchTerm: (value: string) => void;
|
||||
handleSearchMenuClose?: () => void;
|
||||
};
|
||||
|
||||
export function PowerKModalSearchMenu(props: Props) {
|
||||
const { activePage, context, isWorkspaceLevel, searchTerm, updateSearchTerm } = props;
|
||||
const { activePage, context, isWorkspaceLevel, searchTerm, updateSearchTerm, handleSearchMenuClose } = props;
|
||||
// states
|
||||
const [resultsCount, setResultsCount] = useState(0);
|
||||
const [isSearching, setIsSearching] = useState(false);
|
||||
|
|
@ -68,6 +69,11 @@ export function PowerKModalSearchMenu(props: Props) {
|
|||
|
||||
if (activePage) return null;
|
||||
|
||||
const handleClosePalette = () => {
|
||||
handleSearchMenuClose?.();
|
||||
togglePowerKModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{searchTerm.trim() !== "" && (
|
||||
|
|
@ -97,9 +103,7 @@ export function PowerKModalSearchMenu(props: Props) {
|
|||
/>
|
||||
)}
|
||||
|
||||
{searchTerm.trim() !== "" && (
|
||||
<PowerKModalSearchResults closePalette={() => togglePowerKModal(false)} results={results} />
|
||||
)}
|
||||
{searchTerm.trim() !== "" && <PowerKModalSearchResults closePalette={handleClosePalette} results={results} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue