2015-07-25 21:32:18 -07:00
|
|
|
import React, { PropTypes } from 'react';
|
2015-10-15 22:24:05 -07:00
|
|
|
import classnames from 'classnames';
|
2015-10-15 20:03:07 -07:00
|
|
|
import { ListGroup, ListGroupItem } from 'react-bootstrap';
|
2015-07-26 07:56:35 -07:00
|
|
|
import moment from 'moment';
|
2015-07-25 21:32:18 -07:00
|
|
|
|
2015-09-07 23:52:21 -07:00
|
|
|
export default React.createClass({
|
|
|
|
displayName: 'ListJobs',
|
2015-07-25 21:32:18 -07:00
|
|
|
|
2015-09-07 23:52:21 -07:00
|
|
|
propTypes: {
|
2015-09-10 16:26:41 -07:00
|
|
|
handleClick: PropTypes.func,
|
2015-09-07 23:52:21 -07:00
|
|
|
jobs: PropTypes.array
|
|
|
|
},
|
2015-07-25 21:32:18 -07:00
|
|
|
|
2015-10-16 20:05:22 -07:00
|
|
|
addLocation(locale) {
|
|
|
|
if (!locale) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<span className='hidden-xs hidden-sm'>
|
|
|
|
{ locale } - {' '}
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-10-15 20:03:07 -07:00
|
|
|
renderJobs(handleClick, jobs = []) {
|
|
|
|
return jobs
|
|
|
|
.filter(({ isPaid, isApproved, isFilled }) => {
|
|
|
|
return isPaid && isApproved && !isFilled;
|
|
|
|
})
|
|
|
|
.map(({
|
2015-09-07 23:52:21 -07:00
|
|
|
id,
|
|
|
|
company,
|
|
|
|
position,
|
2015-09-14 12:12:31 -07:00
|
|
|
isHighlighted,
|
2015-10-16 16:12:01 -07:00
|
|
|
postedOn,
|
|
|
|
locale
|
2015-10-15 20:03:07 -07:00
|
|
|
}) => {
|
2015-10-15 22:24:05 -07:00
|
|
|
|
|
|
|
const className = classnames({
|
|
|
|
'jobs-list': true,
|
|
|
|
'jobs-list-highlight': isHighlighted
|
|
|
|
});
|
|
|
|
|
2015-10-15 20:03:07 -07:00
|
|
|
return (
|
|
|
|
<ListGroupItem
|
2015-10-15 22:24:05 -07:00
|
|
|
className={ className }
|
2015-10-15 23:43:24 -07:00
|
|
|
key={ id }
|
2015-10-15 20:03:07 -07:00
|
|
|
onClick={ () => handleClick(id) }>
|
|
|
|
<div>
|
|
|
|
<h4 style={{ display: 'inline-block' }}>
|
2015-10-19 14:46:17 -07:00
|
|
|
<bold>{ company }</bold>
|
2015-10-15 20:03:07 -07:00
|
|
|
{' '}
|
|
|
|
<span className='hidden-xs hidden-sm'>
|
|
|
|
- { position }
|
|
|
|
</span>
|
|
|
|
</h4>
|
|
|
|
<h4
|
|
|
|
className='pull-right'
|
|
|
|
style={{ display: 'inline-block' }}>
|
2015-10-16 20:05:22 -07:00
|
|
|
{ this.addLocation(locale) }
|
2015-10-15 20:03:07 -07:00
|
|
|
{ moment(new Date(postedOn)).format('MMM Do') }
|
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
</ListGroupItem>
|
|
|
|
);
|
|
|
|
});
|
2015-09-07 23:52:21 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2015-09-10 16:26:41 -07:00
|
|
|
const {
|
|
|
|
handleClick,
|
|
|
|
jobs
|
|
|
|
} = this.props;
|
|
|
|
|
2015-09-07 23:52:21 -07:00
|
|
|
return (
|
2015-10-15 20:03:07 -07:00
|
|
|
<ListGroup>
|
2015-09-10 16:26:41 -07:00
|
|
|
{ this.renderJobs(handleClick, jobs) }
|
2015-10-15 20:03:07 -07:00
|
|
|
</ListGroup>
|
2015-09-07 23:52:21 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|