From 684698b827326702acfa189229258b4dc9990fb7 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 3 Apr 2024 14:44:16 +0200 Subject: [PATCH] Remove unused old multiselect code Signed-off-by: Julius Volz --- .../src/pages/AlertStateMultiSelect.tsx | 135 ------------------ 1 file changed, 135 deletions(-) delete mode 100644 web/ui/mantine-ui/src/pages/AlertStateMultiSelect.tsx diff --git a/web/ui/mantine-ui/src/pages/AlertStateMultiSelect.tsx b/web/ui/mantine-ui/src/pages/AlertStateMultiSelect.tsx deleted file mode 100644 index 5d237ec1e..000000000 --- a/web/ui/mantine-ui/src/pages/AlertStateMultiSelect.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import { useState } from "react"; -import { - Badge, - CheckIcon, - CloseButton, - Combobox, - ComboboxChevron, - ComboboxClearButton, - Group, - Input, - Pill, - PillGroup, - PillsInput, - useCombobox, -} from "@mantine/core"; -import badgeClasses from "../Badge.module.css"; -import { IconFilter } from "@tabler/icons-react"; -import { IconFilterSearch } from "@tabler/icons-react"; - -interface StatePillProps extends React.ComponentPropsWithoutRef<"div"> { - value: string; - onRemove?: () => void; -} - -export function StatePill({ value, onRemove, ...others }: StatePillProps) { - return ( - - {value} - - ); -} - -export function AlertStateMultiSelect() { - const combobox = useCombobox({ - onDropdownClose: () => combobox.resetSelectedOption(), - onDropdownOpen: () => combobox.updateSelectedOptionIndex("active"), - }); - - const [values, setValues] = useState([]); - - const handleValueSelect = (val: string) => - setValues((current) => - current.includes(val) - ? current.filter((v) => v !== val) - : [...current, val] - ); - - const handleValueRemove = (val: string) => - setValues((current) => current.filter((v) => v !== val)); - - const renderedValues = values.map((item) => ( - handleValueRemove(item)} - key={item} - /> - )); - - const options = ["inactive", "pending", "firing"].map((value) => { - return ( - - - {values.includes(value) ? : null} - - - - ); - }); - - return ( - - - combobox.toggleDropdown()} - miw={200} - leftSection={} - rightSection={ - values.length > 0 ? ( - setValues([])} /> - ) : ( - - ) - } - > - - {renderedValues.length > 0 ? ( - renderedValues - ) : ( - Filter by alert state - )} - - - combobox.closeDropdown()} - onKeyDown={(event) => { - if (event.key === "Backspace") { - event.preventDefault(); - handleValueRemove(values[values.length - 1]); - } - }} - /> - - - - - - - {options} - - - ); -}