// react import React, { useState } from "react"; // headless ui import { Combobox, Dialog, Transition } from "@headlessui/react"; // icons import { MagnifyingGlassIcon, RectangleStackIcon } from "@heroicons/react/24/outline"; // types import { IIssue, IssueResponse } from "types"; import { classNames } from "constants/common"; type Props = { isOpen: boolean; handleClose: () => void; onChange: (...event: any[]) => void; issues: IssueResponse | undefined; }; const IssuesListModal: React.FC = ({ isOpen, handleClose: onClose, onChange, issues }) => { const [query, setQuery] = useState(""); const handleClose = () => { onClose(); setQuery(""); }; const filteredIssues: IIssue[] = query === "" ? issues?.results ?? [] : issues?.results.filter((issue) => issue.name.toLowerCase().includes(query.toLowerCase())) ?? []; return ( <> setQuery("")} appear>
{filteredIssues.length > 0 && (
  • {query === "" && (

    Issues

    )}
      {filteredIssues.map((issue) => ( classNames( "flex items-center gap-2 cursor-pointer select-none rounded-md px-3 py-2", active ? "bg-gray-900 bg-opacity-5 text-gray-900" : "" ) } onClick={() => { // setIssueIdFromList(issue.id); handleClose(); }} > {issue.name} ))}
  • )}
    {query !== "" && filteredIssues.length === 0 && (
    )}
    ); }; export default IssuesListModal;