All files / components/Jobs JobsSearchForm.js

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56        2x             26x                                         26x 78x                   26x                        
import { Container, Row, Col } from "react-bootstrap";
import GenericDropdown from "main/components/Utils/GenericDropdown";
import OurPagination from "main/components/Utils/OurPagination";
 
const JobsSearchForm = ({
  updateSelectedPage,
  updateSortField,
  updateSortDirection,
  updatePageSize,
  totalPages,
}) => {
  const dropdowns = [
    {
      label: "Sort By",
      values: ["createdBy", "createdAt", "updatedAt", "status"],
      controlId: "JobsSearch.SortField",
      onChange: updateSortField,
    },
    {
      label: "Sort Direction",
      values: ["ASC", "DESC"],
      controlId: "JobsSearch.SortDirection",
      onChange: updateSortDirection,
    },
    {
      label: "Page Size",
      values: ["5", "10", "25", "50", "75", "100"],
      controlId: "JobsSearch.PageSize",
      onChange: updatePageSize,
    },
  ];
 
  const renderDropdown = ({ label, values, controlId, onChange }) => (
    <Col md="auto" key={controlId}>
      <GenericDropdown
        label={label}
        values={values}
        controlId={controlId}
        setValue={onChange}
      />
    </Col>
  );
 
  return (
    <Container>
      <Row>{dropdowns.map(renderDropdown)}</Row>
      <OurPagination
        updateActivePage={updateSelectedPage}
        totalPages={totalPages}
      />
    </Container>
  );
};
 
export default JobsSearchForm;