forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request freeCodeCamp#3232 from FreeCodeCamp/feature/jobs
add individual pages to jobs
- Loading branch information
Showing
15 changed files
with
374 additions
and
175 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('object.assign').shim(); | ||
require('es6-map/implement'); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,83 @@ | ||
import React, { PropTypes } from 'react'; | ||
import { contain } from 'thundercats-react'; | ||
import { PanelGroup, Thumbnail, Panel, Well } from 'react-bootstrap'; | ||
import moment from 'moment'; | ||
|
||
export default contain( | ||
{ | ||
}, | ||
React.createClass({ | ||
displayName: 'ListJobs', | ||
export default React.createClass({ | ||
displayName: 'ListJobs', | ||
|
||
propTypes: { | ||
jobs: PropTypes.array | ||
}, | ||
propTypes: { | ||
handleClick: PropTypes.func, | ||
jobs: PropTypes.array | ||
}, | ||
|
||
renderJobs(jobs =[]) { | ||
const thumbnailStyle = { | ||
backgroundColor: 'white', | ||
maxHeight: '100px', | ||
maxWidth: '100px' | ||
}; | ||
return jobs.map(( | ||
{ | ||
id, | ||
company, | ||
position, | ||
description, | ||
logo, | ||
city, | ||
state, | ||
email, | ||
phone, | ||
postedOn | ||
}, | ||
index | ||
) => { | ||
const header = ( | ||
<div> | ||
<h4 style={{ display: 'inline-block' }}>{ company }</h4> | ||
<h5 | ||
className='pull-right hidden-xs hidden-md' | ||
style={{ display: 'inline-block' }}> | ||
{ position } | ||
</h5> | ||
</div> | ||
); | ||
return ( | ||
<Panel | ||
collapsible={ true } | ||
eventKey={ index } | ||
header={ header } | ||
key={ id }> | ||
<Well> | ||
<Thumbnail | ||
alt='200x200' src={ logo } | ||
style={ thumbnailStyle } /> | ||
<Panel> | ||
Position: { position } | ||
Location: { city }, { state } | ||
<br /> | ||
Contact: { email || phone || 'N/A' } | ||
<br /> | ||
Posted On: { moment(postedOn).format('MMMM Do, YYYY') } | ||
</Panel> | ||
<p>{ description }</p> | ||
</Well> | ||
</Panel> | ||
); | ||
}); | ||
}, | ||
renderJobs(handleClick, jobs =[]) { | ||
const thumbnailStyle = { | ||
backgroundColor: 'white', | ||
maxHeight: '100px', | ||
maxWidth: '100px' | ||
}; | ||
|
||
render() { | ||
const { jobs } = this.props; | ||
return jobs.map(( | ||
{ | ||
id, | ||
company, | ||
position, | ||
description, | ||
logo, | ||
city, | ||
state, | ||
email, | ||
phone, | ||
postedOn | ||
}, | ||
index | ||
) => { | ||
const header = ( | ||
<div> | ||
<h4 style={{ display: 'inline-block' }}>{ company }</h4> | ||
<h5 | ||
className='pull-right hidden-xs hidden-md' | ||
style={{ display: 'inline-block' }}> | ||
{ position } | ||
</h5> | ||
</div> | ||
); | ||
return ( | ||
<PanelGroup> | ||
{ this.renderJobs(jobs) } | ||
</PanelGroup> | ||
<Panel | ||
collapsible={ true } | ||
eventKey={ index } | ||
header={ header } | ||
key={ id }> | ||
<Well> | ||
<Thumbnail | ||
alt={ company + 'company logo' } | ||
src={ logo } | ||
style={ thumbnailStyle } /> | ||
<Panel> | ||
Position: { position } | ||
Location: { city }, { state } | ||
<br /> | ||
Contact: { email || phone || 'N/A' } | ||
<br /> | ||
Posted On: { moment(postedOn).format('MMMM Do, YYYY') } | ||
</Panel> | ||
<p onClick={ () => handleClick(id) }>{ description }</p> | ||
</Well> | ||
</Panel> | ||
); | ||
} | ||
}) | ||
); | ||
}); | ||
}, | ||
|
||
render() { | ||
const { | ||
handleClick, | ||
jobs | ||
} = this.props; | ||
|
||
return ( | ||
<PanelGroup> | ||
{ this.renderJobs(handleClick, jobs) } | ||
</PanelGroup> | ||
); | ||
} | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,88 @@ | ||
import React, { PropTypes } from 'react'; | ||
import { Thumbnail, Panel, Well } from 'react-bootstrap'; | ||
import { contain } from 'thundercats-react'; | ||
import { Row, Thumbnail, Panel, Well } from 'react-bootstrap'; | ||
import moment from 'moment'; | ||
|
||
const thumbnailStyle = { | ||
backgroundColor: 'white', | ||
maxHeight: '100px', | ||
maxWidth: '100px' | ||
}; | ||
export default React.createClass({ | ||
displayName: 'ShowJob', | ||
propTypes: { | ||
job: PropTypes.object | ||
}, | ||
|
||
renderHeader({ company, position }) { | ||
return ( | ||
<div> | ||
<h4 style={{ display: 'inline-block' }}>{ company }</h4> | ||
<h5 | ||
className='pull-right hidden-xs hidden-md' | ||
style={{ display: 'inline-block' }}> | ||
{ position } | ||
</h5> | ||
</div> | ||
); | ||
export default contain( | ||
{ | ||
store: 'jobsStore', | ||
fetchAction: 'jobActions.getJob', | ||
map({ currentJob }) { | ||
return { job: currentJob }; | ||
}, | ||
getPayload({ params: { id }, job = {} }) { | ||
return { | ||
id, | ||
isPrimed: job.id === id | ||
}; | ||
}, | ||
// using es6 destructuring | ||
shouldContainerFetch({ job = {} }, { params: { id } } | ||
) { | ||
return job.id !== id; | ||
} | ||
}, | ||
React.createClass({ | ||
displayName: 'ShowJob', | ||
propTypes: { | ||
job: PropTypes.object, | ||
params: PropTypes.object | ||
}, | ||
|
||
renderHeader({ company, position }) { | ||
return ( | ||
<div> | ||
<h4 style={{ display: 'inline-block' }}>{ company }</h4> | ||
<h5 | ||
className='pull-right hidden-xs hidden-md' | ||
style={{ display: 'inline-block' }}> | ||
{ position } | ||
</h5> | ||
</div> | ||
); | ||
}, | ||
|
||
render() { | ||
const { job } = this.props; | ||
const { | ||
logo, | ||
position, | ||
city, | ||
state, | ||
email, | ||
phone, | ||
postedOn, | ||
description | ||
} = job; | ||
render() { | ||
const { job = {} } = this.props; | ||
const { | ||
logo, | ||
position, | ||
city, | ||
company, | ||
state, | ||
email, | ||
phone, | ||
postedOn, | ||
description | ||
} = job; | ||
|
||
return ( | ||
<Well> | ||
<Thumbnail | ||
alt='200x200' src={ logo } | ||
style={ thumbnailStyle } /> | ||
<Panel> | ||
Position: { position } | ||
Location: { city }, { state } | ||
<br /> | ||
Contact: { email || phone || 'N/A' } | ||
<br /> | ||
Posted On: { moment(postedOn).format('MMMM Do, YYYY') } | ||
</Panel> | ||
<p>{ description }</p> | ||
</Well> | ||
); | ||
} | ||
}); | ||
return ( | ||
<div> | ||
<Row> | ||
<Well> | ||
<Thumbnail | ||
alt={ company + 'company logo' } | ||
src={ logo } | ||
style={ thumbnailStyle } /> | ||
<Panel> | ||
Position: { position } | ||
Location: { city }, { state } | ||
<br /> | ||
Contact: { email || phone || 'N/A' } | ||
<br /> | ||
Posted On: { moment(postedOn).format('MMMM Do, YYYY') } | ||
</Panel> | ||
<p>{ description }</p> | ||
</Well> | ||
</Row> | ||
</div> | ||
); | ||
} | ||
}) | ||
); |
Oops, something went wrong.