Last active
May 23, 2017 08:49
-
-
Save andrewmclagan/d413bffd37734e7615a2953b109dc6e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import DataTable from 'components/DataTable'; | |
import CollectionViewControls from 'components/CollectionViewControls'; | |
/** | |
* Entity collection view | |
* @author Andrew McLagan <[email protected]> | |
*/ | |
export default ({ collection, children, filters, className }) => ( | |
<div className={`entity-listing-container ${className}`}> | |
<CollectionViewControls results={collection.size} filters={filters} /> | |
<DataTable rows={collection}> | |
{children} | |
</DataTable> | |
</div> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { connect } from 'react-redux'; | |
import { Jobs } from 'ethical-jobs-redux-modules'; | |
import CollectionView from 'components/CollectionView'; | |
import PageTitle from './PageTitle'; | |
/** | |
* Jobs collection container | |
* @author Andrew McLagan <[email protected]> | |
*/ | |
export class JobCollection extends React.Component { | |
componentWillMount() { | |
this.props.clearColleciton(); | |
} | |
componentDidMount() { | |
return this.props.fetchCollection({ | |
status: 'APPROVED', | |
expired: false, | |
}); | |
} | |
render() { | |
const { jobs, filters, fetchJobs, clearJobs } = this.props; | |
return ( | |
<div className="jobs-container"> | |
<PageTitle jobType={jobType} /> | |
<CollectionView | |
filters={filters} | |
clearColleciton={clearJobs} | |
fetchCollection={fetchJobs} | |
collection={jobs} | |
/> | |
</div> | |
); | |
} | |
} | |
const mapStateToProps = state => ({ | |
jobs: Jobs.selectors.jobsSelector(state), | |
filters: Jobs.selectors.jobsFiltersSelector(state), | |
}); | |
const mapDispatchToProps = { | |
fetchJobs: Jobs.actions.fetchJobs, | |
clearJobs: Jobs.actions.clearJobs, | |
}; | |
export default connect(mapStateToProps, mapDispatchToProps)(JobCollection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment