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

82 lines
1.8 KiB
JavaScript
Raw Normal View History

2015-07-25 21:32:18 -07:00
import React, { PropTypes } from 'react';
import { contain } from 'thundercats-react';
2015-08-13 12:33:53 -07:00
import { PanelGroup, Thumbnail, Panel, Well } from 'react-bootstrap';
import moment from 'moment';
2015-07-25 21:32:18 -07:00
export default contain(
{
},
React.createClass({
displayName: 'ListJobs',
2015-07-25 21:32:18 -07:00
propTypes: {
jobs: PropTypes.array
},
renderJobs(jobs =[]) {
const thumbnailStyle = {
backgroundColor: 'white',
maxHeight: '200px',
maxWidth: '200px'
};
2015-07-25 21:32:18 -07:00
return jobs.map((
{
id,
company,
position,
description,
logo,
city,
state,
email,
phone,
postedOn
},
2015-07-25 21:32:18 -07:00
index
) => {
const header = (
<div>
<h4 style={{ display: 'inline-block' }}>{ company }</h4>
<h5
2015-07-26 18:42:26 -07:00
className='pull-right hidden-xs hidden-md'
2015-07-25 21:32:18 -07:00
style={{ display: 'inline-block' }}>
{ position }
</h5>
</div>
);
return (
<Panel
2015-08-13 12:33:53 -07:00
collapsible={ true }
2015-07-25 21:32:18 -07:00
eventKey={ index }
header={ header }
key={ id }>
<Well>
2015-08-13 12:33:53 -07:00
<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>
2015-07-25 21:32:18 -07:00
</Panel>
);
});
},
render() {
const { jobs } = this.props;
return (
2015-08-13 12:33:53 -07:00
<PanelGroup>
2015-07-25 21:32:18 -07:00
{ this.renderJobs(jobs) }
2015-08-13 12:33:53 -07:00
</PanelGroup>
2015-07-25 21:32:18 -07:00
);
}
})
);