import React from "react";
import PropTypes from "prop-types";
import FilterCheckboxDropdown from "../../FilterDropdown/Checkbox/FilterCheckboxDropdown";
import { LocationIcon } from "./LocationChoser.styled";
import { useTranslation } from "react-i18next";

const LocationChoser = (props) => {
  const { t } = useTranslation();
  const filters = props.filters;
  return (
    <FilterCheckboxDropdown
      searchPlaceholder={t("filters.location.placeholder")}
      data={[...filters.locations.allLocations]}
      filters={[...filters.locations.selectedLocationsLocally]}
      icon={<LocationIcon />}
      title={t("filters.location.title")}
      setItemsSelected={filters.locations.setSelectedLocations}
    />
  );
};

LocationChoser.propTypes = {
  filters: PropTypes.any,
};

export default LocationChoser;
