diff --git a/src/components/TopologyFilters/TopologyFilterBar.tsx b/src/components/TopologyFilters/TopologyFilterBar.tsx index 2e10a3036..5fdb5e8e7 100644 --- a/src/components/TopologyFilters/TopologyFilterBar.tsx +++ b/src/components/TopologyFilters/TopologyFilterBar.tsx @@ -7,6 +7,7 @@ import { ComponentLabelsDropdown } from "../Dropdown/ComponentLabelsDropdown"; import { ComponentTypesDropdown } from "../Dropdown/ComponentTypesDropdown"; import { ReactSelectDropdown, StateOption } from "../ReactSelectDropdown"; import TopologyPopOver from "../TopologyPopover"; +import { TopologySort } from "../TopologyPopover/topologySort"; type TopologyFilterBarProps = { data?: GetTopologyApiResponse; @@ -155,14 +156,13 @@ export default function TopologyFilterBar({ }} /> + +
+ +
- + + ); } diff --git a/src/components/TopologyPopover/index.tsx b/src/components/TopologyPopover/index.tsx index 77df972fc..a026831e2 100644 --- a/src/components/TopologyPopover/index.tsx +++ b/src/components/TopologyPopover/index.tsx @@ -1,7 +1,5 @@ import { NavigateOptions, URLSearchParamsInit } from "react-router-dom"; - import { TopologyPreference } from "./topologyPreference"; -import { defaultSortLabels, TopologySort } from "./topologySort"; export type SetURLSearchParams = ( nextInit?: @@ -10,30 +8,23 @@ export type SetURLSearchParams = ( navigateOpts?: NavigateOptions ) => void; -export const TopologyPopOver = ({ - size, - setSize, - sortLabels, - searchParams, - setSearchParams -}: { +type TopologyPopOverProps = { size: string; - sortLabels: typeof defaultSortLabels; setSize: (v: string) => void; - searchParams: URLSearchParams; - setSearchParams: SetURLSearchParams; -}) => { +}; + +export default function TopologyPopOver({ + size, + setSize +}: TopologyPopOverProps) { const setCardWidth = (width: string) => { setSize(`${width}px`); localStorage.setItem("topology_card_width", `${width}px`); }; return ( -
- +
); -}; - -export default TopologyPopOver; +} diff --git a/src/components/TopologyPopover/topologySort.tsx b/src/components/TopologyPopover/topologySort.tsx index 7acd07974..f87c76527 100644 --- a/src/components/TopologyPopover/topologySort.tsx +++ b/src/components/TopologyPopover/topologySort.tsx @@ -148,26 +148,30 @@ export const TopologySort = ({ <>
} - className="flex mt-1 cursor-pointer md:mt-0 md:items-center border border-gray-300 bg-white rounded-md shadow-sm px-3 py-2" + className="flex cursor-pointer p-0 items-center border border-gray-300 bg-white rounded-md shadow-sm" > - {sortByDirection === "asc" && ( - onSelectSortOption(sortBy, "desc")} - /> - )} - {sortByDirection === "desc" && ( - onSelectSortOption(sortBy, "asc")} - /> - )} - + onSelectSortOption( + sortBy, + sortByDirection === "asc" ? "desc" : "asc" + ) + } + className="flex items-center justify-center text-gray-700 hover:text-gray-900 px-3 py-1 pr-1 rounded-l-md h-full" + > + {sortByDirection === "asc" && ( + + )} + {sortByDirection === "desc" && ( + + )} +
+
setIsPopoverActive((val) => !val)} > {sortLabels.find((s) => s.value === sortBy)?.label} - +