import PropTypes from "prop-types";
import CompaniesListItem from "./CompaniesListItem.jsx";
import { useCompanies } from "../../contexts/CompaniesContext";

const CompaniesList = () => {
  const { companies } = useCompanies();
  return (
    <div className="tb-companies-list-container">
      <div className="tb-companies-list">
        {companies.map((company, i) => (
          <CompaniesListItem companyData={company} key={i} />
        ))}
      </div>
    </div>
  );
};

CompaniesList.propTypes = {
  companies: PropTypes.array,
};

export default CompaniesList;
