import { Collapse } from "antd";
import { SlArrowDown } from "react-icons/sl";
import BrandFilter from "../../Components/Products/BrandFilter";
import SearchButton from "../../Components/Utils/Search/SearchButton";
import { useGetCategory } from "../../api/category";


const FilterSection = ({isLoading}:{isLoading:boolean}) => {
  const [noDataFound, setNoDataFound] = useState(false);
  const [openSearch, setOpenSearch] = useState(false);

  const {data:category} = useGetCategory();
  
  const items = category?.data?.map((e:any)=>({
    key:e.id,
    label:e.name,
    children: <BrandFilter id={e.id}/>
  }))


  return (
    <>
    <SearchButton setOpen={setOpenSearch} setNoDataFound={setNoDataFound} />
    <Collapse
      className="filter_collapse"
      expandIconPosition="end"
      expandIcon={SlArrowDown}
      defaultActiveKey={["1"]}
      ghost
      items={items}
    />
    </>
  );
}

export default FilterSection;
