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
2015-08-25 12:25:30 -07:00
import ListJobs from './List.jsx' ;
2015-10-19 14:19:04 -07:00
import TwitterBtn from './TwitterBtn.jsx' ;
2015-06-17 21:04:28 -07:00
2015-07-25 13:58:26 -07:00
export default contain (
{
store : 'jobsStore' ,
2015-09-10 16:26:41 -07:00
fetchAction : 'jobActions.getJobs' ,
2015-10-16 20:05:22 -07:00
actions : [
'appActions' ,
'jobActions'
]
2015-07-25 13:58:26 -07:00
} ,
React . createClass ( {
displayName : 'Jobs' ,
2015-09-10 16:26:41 -07:00
2015-07-25 13:58:26 -07:00
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 ,
2015-09-10 16:26:41 -07:00
jobActions : PropTypes . object ,
2015-09-14 13:06:27 -07:00
jobs : PropTypes . array ,
showModal : PropTypes . bool
2015-07-25 13:58:26 -07:00
} ,
2015-09-10 16:26:41 -07:00
2015-10-19 14:19:04 -07:00
componentDidMount ( ) {
const { jobActions } = this . props ;
jobActions . getFollowers ( ) ;
} ,
2015-09-10 16:26:41 -07:00
handleJobClick ( id ) {
2015-10-16 20:05:22 -07:00
const { appActions , jobActions } = this . props ;
2015-09-10 16:26:41 -07:00
if ( ! id ) {
return null ;
}
jobActions . findJob ( id ) ;
2015-10-27 23:46:42 -07:00
appActions . updateRoute ( ` /jobs/ ${ id } ` ) ;
2015-09-10 16:26:41 -07:00
} ,
2015-06-17 21:04:28 -07:00
2015-09-10 16:26:41 -07:00
renderList ( handleJobClick , jobs ) {
2015-07-25 21:32:18 -07:00
return (
2015-09-10 16:26:41 -07:00
< ListJobs
handleClick = { handleJobClick }
jobs = { jobs } / >
2015-07-25 21:32:18 -07:00
) ;
} ,
renderChild ( child , jobs ) {
if ( ! child ) {
return null ;
}
return cloneElement (
child ,
{ jobs }
) ;
} ,
2015-07-25 13:58:26 -07:00
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
2015-07-25 13:58:26 -07:00
return (
2015-10-15 20:03:07 -07:00
< Panel >
2015-07-25 13:58:26 -07:00
< 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-12 16:36:08 -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
< / h 1 >
2015-11-12 16:36:08 -08:00
< 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
2015-11-12 16:36:08 -08:00
className = 'signup-btn btn-block btn-cta'
2015-10-16 20:05:22 -07:00
onClick = { ( ) => {
2015-10-27 23:46:42 -07:00
appActions . updateRoute ( '/jobs/new' ) ;
2015-10-16 20:05:22 -07:00
} } >
2015-11-12 16:36:08 -08:00
Post a job : $200 for 30 days
2015-10-15 21:10:06 -07:00
< / B u t t o n >
< div className = 'spacer' / >
< / C o l >
< / R o w >
2015-11-12 16:36:08 -08:00
< div className = 'spacer' / >
< Row >
< Col
md = { 2 }
xs = { 4 } >
< img className = "img-responsive testimonial-image-jobs img-center" src = "http://i.imgur.com/tGcAA8H.jpg" alt = "a photo of Michael Gai, who recently hired a software engineer through Free Code Camp" / >
< / C o l >
< Col
md = { 10 }
xs = { 8 } >
< blockquote >
< 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 < / c i t e > < / f o o t e r >
< / b l o c k q u o t e >
< / C o l >
< / R o w >
2015-10-15 21:10:06 -07:00
< Row >
{ this . renderChild ( children , jobs ) ||
this . renderList ( this . handleJobClick , jobs ) }
< / R o w >
< / C o l >
2015-07-25 13:58:26 -07:00
< / R o w >
2015-10-15 20:03:07 -07:00
< / P a n e l >
2015-07-25 13:58:26 -07:00
) ;
}
} )
) ;