Move CoreComponent module

This commit is contained in:
Nicolas Gallagher
2015-09-07 12:58:48 -07:00
parent b9c8a560a0
commit 6d4c9e881f
2 changed files with 40 additions and 43 deletions

View File

@@ -1,3 +1,42 @@
import CoreComponent from './modules/CoreComponent'
import React, { PropTypes } from 'react'
import restyle from './modules/restyle'
import stylePropTypes from './modules/stylePropTypes'
class CoreComponent extends React.Component {
static propTypes = {
className: PropTypes.string,
component: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string
]),
style: PropTypes.object,
testID: PropTypes.string
}
static stylePropTypes = stylePropTypes;
static defaultProps = {
className: '',
component: 'div'
}
render() {
const {
className,
component: Component,
style,
testID,
...other
} = this.props
return (
<Component
{...other}
{...restyle({ className, style })}
data-testid={process.env.NODE_ENV === 'production' ? null : testID}
/>
)
}
}
export default CoreComponent

View File

@@ -1,42 +0,0 @@
import React, { PropTypes } from 'react'
import restyle from './restyle'
import stylePropTypes from './stylePropTypes'
class CoreComponent extends React.Component {
static propTypes = {
className: PropTypes.string,
component: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string
]),
style: PropTypes.object,
testID: PropTypes.string
}
static stylePropTypes = stylePropTypes;
static defaultProps = {
className: '',
component: 'div'
}
render() {
const {
className,
component: Component,
style,
testID,
...other
} = this.props
return (
<Component
{...other}
{...restyle({ className, style })}
data-testid={process.env.NODE_ENV === 'production' ? null : testID}
/>
)
}
}
export default CoreComponent