diff --git a/src/components/Canary/index.tsx b/src/components/Canary/index.tsx
index 404ac4c6b..04744a242 100644
--- a/src/components/Canary/index.tsx
+++ b/src/components/Canary/index.tsx
@@ -35,6 +35,8 @@ import {
separateLabelsByBooleanType
} from "./labels";
import { decodeUrlSearchParams, useUpdateParams } from "./url";
+import { IconButton } from "../IconButton";
+import { FaFilter } from "react-icons/fa";
const FilterKeyToLabelMap = {
environment: "Environment",
@@ -74,6 +76,7 @@ export function Canary({
const tabBy = searchParams.get("tabBy");
const groupBy = searchParams.get("groupBy");
const refreshInterval = useRefreshRateFromLocalStorage();
+ const [isMenuItemOpen, setIsMenuItemOpen] = useState(false);
const [isLoading, setIsLoading] = useState(true);
@@ -217,10 +220,15 @@ export function Canary({
-
+
-
+
+
+ {
+ setIsMenuItemOpen((prev) => !prev);
+ }}
+ title="filter"
+ icon={}
+ />
+
handleSearch(e.target.value)}
@@ -630,20 +647,52 @@ type SidebarStickyProps = {
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
+ isMenuItemOpen?: boolean;
+ setMenuItemOpen?: (isOpen: boolean) => void;
};
function SidebarSticky({
className,
style,
children,
+ isMenuItemOpen = false,
+ setMenuItemOpen = () => {},
...props
}: SidebarStickyProps) {
+ const ref = useRef(null);
+
+ useEffect(() => {
+ function handleClickOutside(event: any) {
+ if (ref.current && !ref.current.contains(event.target)) {
+ setMenuItemOpen(false);
+ }
+ }
+
+ function keyPress(e: KeyboardEvent) {
+ if (e.key === "Escape") {
+ setMenuItemOpen(false);
+ }
+ }
+
+ document.addEventListener("mousedown", handleClickOutside);
+ document.addEventListener("keydown", keyPress);
+ return () => {
+ document.removeEventListener("mousedown", handleClickOutside);
+ document.removeEventListener("keydown", keyPress);
+ };
+ }, [ref, setMenuItemOpen]);
+
return (