Files
freeCodeCamp/common/app/routes/Jobs/components/Jobs.jsx

135 lines
3.6 KiB
JavaScript
Raw Normal View History

2015-07-25 21:32:18 -07:00
import React, { cloneElement, PropTypes } from 'react';
2015-07-25 15:15:59 -07:00
import { contain } from 'thundercats-react';
2015-10-15 21:10:06 -07:00
import { Button, Panel, Row, Col } from 'react-bootstrap';
2015-09-14 13:06:27 -07:00
import ListJobs from './List.jsx';
2015-06-17 21:04:28 -07:00
export default contain(
{
store: 'jobsStore',
fetchAction: 'jobActions.getJobs',
2015-10-16 20:05:22 -07:00
actions: [
'appActions',
'jobActions'
]
},
React.createClass({
displayName: 'Jobs',
propTypes: {
2015-07-25 21:32:18 -07:00
children: PropTypes.element,
2015-10-19 14:19:04 -07:00
numOfFollowers: PropTypes.number,
2015-10-16 20:05:22 -07:00
appActions: PropTypes.object,
jobActions: PropTypes.object,
2015-09-14 13:06:27 -07:00
jobs: PropTypes.array,
showModal: PropTypes.bool
},
2015-10-19 14:19:04 -07:00
componentDidMount() {
const { jobActions } = this.props;
jobActions.getFollowers();
},
handleJobClick(id) {
2015-10-16 20:05:22 -07:00
const { appActions, jobActions } = this.props;
if (!id) {
return null;
}
jobActions.findJob(id);
appActions.updateRoute(`/jobs/${id}`);
},
2015-06-17 21:04:28 -07:00
renderList(handleJobClick, jobs) {
2015-07-25 21:32:18 -07:00
return (
<ListJobs
handleClick={ handleJobClick }
jobs={ jobs }/>
2015-07-25 21:32:18 -07:00
);
},
renderChild(child, jobs) {
if (!child) {
return null;
}
return cloneElement(
child,
{ jobs }
);
},
render() {
2015-09-14 13:06:27 -07:00
const {
children,
jobs,
2015-10-16 20:05:22 -07:00
appActions
2015-09-14 13:06:27 -07:00
} = this.props;
2015-07-25 21:32:18 -07:00
return (
<Panel>
<Row>
2015-10-15 21:10:06 -07:00
<Col
md={ 10 }
mdOffset= { 1 }
xs={ 12 }>
2015-10-30 12:55:13 -07:00
<h1 className='text-center'>
2015-11-13 11:31:55 -08:00
Hire a JavaScript engineer who's experienced in HTML5,
Node.js, MongoDB, and Agile Development.
2015-10-30 12:55:13 -07:00
</h1>
<div className='spacer' />
2015-10-16 16:12:01 -07:00
<Row className='text-center'>
<Col
sm={ 8 }
2015-10-16 20:05:22 -07:00
smOffset={ 2 }
xs={ 12 }>
2015-10-15 21:10:06 -07:00
<Button
className='signup-btn btn-block btn-cta'
2015-10-16 20:05:22 -07:00
onClick={ ()=> {
appActions.updateRoute('/jobs/new');
2015-10-16 20:05:22 -07:00
}}>
2015-11-30 14:33:39 -08:00
Post a job: $1000
2015-10-15 21:10:06 -07:00
</Button>
<div className='spacer' />
</Col>
</Row>
<div className='spacer' />
<Row>
<Col
md={ 2 }
xs={ 4 }>
2015-11-13 11:31:55 -08:00
<img
alt={`
a photo of Michael Gai, who recently hired a software
engineer through Free Code Camp
`}
className='img-responsive testimonial-image-jobs img-center'
src='http://i.imgur.com/tGcAA8H.jpg' />
</Col>
<Col
md={ 10 }
xs={ 8 }>
<blockquote>
2015-11-13 11:31:55 -08:00
<p>
We hired our last developer out of Free Code Camp
and couldn't be happier. Free Code Camp is now
our go-to way to bring on pre-screened candidates
who are enthusiastic about learning quickly and
becoming immediately productive in their new career.
</p>
<footer>
Michael Gai, <cite>CEO at CoNarrative</cite>
</footer>
</blockquote>
</Col>
</Row>
2015-10-15 21:10:06 -07:00
<Row>
{ this.renderChild(children, jobs) ||
this.renderList(this.handleJobClick, jobs) }
</Row>
</Col>
</Row>
</Panel>
);
}
})
);