import * as React from "react"; import { useMenuState, MenuButton } from "reakit/Menu"; import styled from "styled-components"; import { s } from "@shared/styles"; import Button, { Inner } from "~/components/Button"; import ContextMenu from "~/components/ContextMenu"; import MenuItem from "~/components/ContextMenu/MenuItem"; import Text from "~/components/Text"; type TFilterOption = { key: string; label: string; note?: string; icon?: React.ReactNode; }; type Props = { options: TFilterOption[]; selectedKeys: (string | null | undefined)[]; defaultLabel?: string; selectedPrefix?: string; className?: string; onSelect: (key: string | null | undefined) => void; }; const FilterOptions = ({ options, selectedKeys = [], defaultLabel = "Filter options", selectedPrefix = "", className, onSelect, }: Props) => { const menu = useMenuState({ modal: true, }); const selectedItems = options.filter((option) => selectedKeys.includes(option.key) ); const selectedLabel = selectedItems.length ? selectedItems .map((selected) => `${selectedPrefix} ${selected.label}`) .join(", ") : ""; return (