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 style from './style' | |
import React from 'react' | |
const Btn = React.createClass({ | |
render () { | |
return ( | |
<button className={style.Btn}> | |
Submit | |
<button> | |
) |
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 style from './style' | |
import CSSModules from 'react-css-modules' | |
import React from 'react' | |
/** | |
* Notice use of `styleName` vs. `className` | |
*/ | |
const Btn = React.createClass({ | |
render () { | |
return ( |
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
.Btn { | |
padding: .8em 1.5em; | |
color: white; | |
background-color: #EC87C0; | |
border: none; | |
} | |
.disabled { | |
background-color: #BBBBBB; | |
} |
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 Job from 'JobComponent' | |
const jobData = { | |
title: "Looking for help", | |
employerId: "uniqueId" | |
} | |
const JobRenderTypes = React.createClass({ | |
render () { |
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} /> | |
}, |
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
render () { | |
const { data, renderAs } = this.props | |
const types = { | |
listing: JobListing, | |
heading: JobHeading, | |
card: JobCard | |
} | |
const render = { | |
me: types[renderAs] | |
} |
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
render () { | |
const { data, renderAs } = this.props | |
const types = { | |
listing: JobListing, | |
heading: JobHeading, | |
card: JobCard | |
} | |
const component = types[renderAs] // this one will NOT work | |
const $component = types[renderAs] // this one WILL | |
return ( |
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
render () { | |
const { data, renderAs } = this.props | |
const types = { | |
listing: JobListing, | |
heading: JobHeading, | |
card: JobCard | |
} | |
const component = types[renderAs] | |
const $component = types[renderAs] |
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 style from './style' | |
import React, { PropTypes } from 'react' | |
import CSSModules from 'react-css-modules' | |
import createJob from 'JobFactory' | |
import listing from './components/org.JobListing' | |
import heading from './components/org.JobHeading' | |
import details from './components/org.JobDetails' | |
import card from './components/org.JobCard' | |
const DEFAULT_RENDER_TYPE = 'listing' |
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
const DynamicRenderer = React.createClass({ | |
render () { | |
const component = this.props.condition | |
? SomeComponent | |
: SomeOtherComponent | |
// This will NOT work as expected | |
return <component /> | |
} | |
}) |