Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
feat(jobs): Integrate filter by location of jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
AjanShrestha committed Dec 23, 2019
1 parent a46008d commit 75c7554
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/src/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';
import Job from './Job';
import JobModal from './JobModal';
import LocationRadio from './LocationRadio';
import {filterJobsByLocation} from './utils';

export default function Jobs({jobs}) {
// location radio section
Expand All @@ -16,9 +17,8 @@ export default function Jobs({jobs}) {
setLocation(event.target.value);
};

const handleChange = event => {
setSelectedLocation(event.target.value);
};
// filter jobs based on location
const filteredJobs = filterJobsByLocation(jobs, location);

// modal
const [open, setOpen] = React.useState(false);
Expand All @@ -31,10 +31,10 @@ export default function Jobs({jobs}) {
};

// pagination
const numJobs = jobs.length;
const numJobs = filteredJobs.length;
const numPages = Math.ceil(numJobs / 50);
const [activeStep, setActiveStep] = React.useState(0);
const jobsOnPage = jobs.slice(activeStep * 50, activeStep * 50 + 50);
const jobsOnPage = filteredJobs.slice(activeStep * 50, activeStep * 50 + 50);

// step == 0, show 0-49
// step == 1, show 50-99
Expand Down

0 comments on commit 75c7554

Please sign in to comment.