import React, { cloneElement, PropTypes } from 'react';
import { contain } from 'thundercats-react';
import { Button, Panel, Row, Col } from 'react-bootstrap';
import ListJobs from './List.jsx';
import TwitterBtn from './TwitterBtn.jsx';
export default contain(
{
store: 'jobsStore',
fetchAction: 'jobActions.getJobs',
actions: [
'appActions',
'jobActions'
]
},
React.createClass({
displayName: 'Jobs',
propTypes: {
children: PropTypes.element,
numOfFollowers: PropTypes.number,
appActions: PropTypes.object,
jobActions: PropTypes.object,
jobs: PropTypes.array,
showModal: PropTypes.bool
},
componentDidMount() {
const { jobActions } = this.props;
jobActions.getFollowers();
},
handleJobClick(id) {
const { appActions, jobActions } = this.props;
if (!id) {
return null;
}
jobActions.findJob(id);
appActions.updateRoute(`/jobs/${id}`);
},
renderList(handleJobClick, jobs) {
return (
);
},
renderChild(child, jobs) {
if (!child) {
return null;
}
return cloneElement(
child,
{ jobs }
);
},
render() {
const {
children,
numOfFollowers,
jobs,
appActions
} = this.props;
return (
Hire JavaScript engineers experienced in
HTML5, Node.js, MongoDB, and Agile Development
{ this.renderChild(children, jobs) ||
this.renderList(this.handleJobClick, jobs) }
);
}
})
);