import React, { PropTypes } from 'react'; import { Row, Col, Thumbnail } from 'react-bootstrap'; import PureComponent from 'react-pure-render/component'; import urlRegexFactory from 'url-regex'; const urlRegex = urlRegexFactory(); const defaultImage = 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png'; const thumbnailStyle = { backgroundColor: 'white', maxHeight: '100px', maxWidth: '100px' }; function addATags(text) { return text.replace(urlRegex, function(match) { return `${match}`; }); } export default class extends PureComponent { static displayName = 'ShowJob'; static propTypes = { job: PropTypes.object, params: PropTypes.object, showApply: PropTypes.bool, preview: PropTypes.bool, message: PropTypes.string }; renderHeader({ company, position }) { return (

{ company }

{ position }
); } renderHowToApply(showApply, preview, message, howToApply) { if (!showApply) { return (

{ message }

); } return (
{ preview ? 'How do I apply?' : message }

); } render() { const { showApply = true, message, preview = true, job = {} } = this.props; const { logo, position, city, company, state, locale, description, howToApply } = job; return (

{ company }

Position: { position || 'N/A' }
Location: { locale ? locale : `${city}, ${state}` }

{ description }

{ this.renderHowToApply(showApply, preview, message, howToApply) }
); } }