Created
September 15, 2015 17:08
-
-
Save mikeyamadeo/4692955a7ba937539b67 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import React from 'react' | |
import JobListing from './components/org.JobListing' | |
import JobHeading from './components/org.JobHeading' | |
import JobCard from './components/org.JobCard' | |
// well this is repetitive :/.... | |
const renderAs = { | |
listing (data) { | |
return <JobListing data={data} /> | |
}, | |
heading(data) { | |
return <JobHeading data={data} /> | |
}, | |
card (data) { | |
return <JobCard data={data} /> | |
} | |
} | |
const Job = React.createClass({ | |
render () { | |
const { data, renderAs } = this.props | |
const renderFn = renderAs[renderAs] | |
const content = renderFn ? renderFn(data) : '' | |
return ( | |
<div className="Job"> | |
{ content } | |
</div> | |
) | |
} | |
}) | |
export default Job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment