Skip to content

Commit

Permalink
Merge pull request #245 from yamafaktory/master
Browse files Browse the repository at this point in the history
Update PropTypes to get in sync with React v15.5.4
  • Loading branch information
donaldpipowitch authored May 4, 2017
2 parents 5e7d988 + 0a467aa commit b3cbddf
Show file tree
Hide file tree
Showing 7 changed files with 229 additions and 194 deletions.
8 changes: 4 additions & 4 deletions examples/tweet/content.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createElement } from '../../src/react' // eslint-disable-line no-unused-vars
/** @jsx createElement */

import React, { PropTypes } from 'react' //eslint-disable-line no-unused-vars
import PropTypes from 'prop-types'
import React from 'react'
import { merge, select } from '../../src'
import { vars } from '../../src/react'

Expand All @@ -13,7 +14,7 @@ export class Content extends React.Component {
text: PropTypes.string
}
styles = {
text: merge({
text: merge({
fontSize: '1.25rem',
fontWeight: 300,
lineHeight: '1.5em',
Expand All @@ -35,7 +36,7 @@ export class Content extends React.Component {
}
render() {
let { media, text } = this.props
let styles = this.styles
let styles = this.styles
return <div>
<p css={styles.text} dangerouslySetInnerHTML={{ __html: text }} />
<a css={styles.media} href={media.expanded_url}>
Expand All @@ -44,4 +45,3 @@ export class Content extends React.Component {
</div>
}
}

11 changes: 6 additions & 5 deletions examples/tweet/footer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createElement } from '../../src/react' // eslint-disable-line no-unused-vars
/** @jsx createElement */

import React, { Component, PropTypes } from 'react' // eslint-disable-line no-unused-vars
import PropTypes from 'prop-types'
import React, { Component } from 'react' // eslint-disable-line no-unused-vars

import { reply, retweet, like, more } from './svgs'

Expand Down Expand Up @@ -68,7 +69,7 @@ export class Footer extends Component {
flexGrow: 1,
justifyContent: 'center',
textAlign: 'center',

background: 'none',
border: 'none',
color: 'inherit',
Expand All @@ -81,7 +82,7 @@ export class Footer extends Component {
color: this.props.vars.animation
}
}

handleClick = () => {
this.setState({
liked: !this.state.liked
Expand All @@ -91,7 +92,7 @@ export class Footer extends Component {
render() {
const { createdAt, favoriteCount, retweetCount } = this.props
const { liked } = this.state
let { styles } = this
let { styles } = this

return (
<div>
Expand All @@ -116,7 +117,7 @@ export class Footer extends Component {
{retweet}
</div>
<button css={styles.button} onClick={this.handleClick}>
{like(liked && style(styles.liked))}
{like(liked && style(styles.liked))}
</button>
<div css={styles.icon}>
{more}
Expand Down
6 changes: 3 additions & 3 deletions examples/tweet/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { createElement } from '../../src/react' // eslint-disable-line no-unused


// @value primary, secondary from 'styles/colors.css';
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import { merge, select, before } from '../../src'
import { vars } from '../../src/react'

Expand Down Expand Up @@ -70,7 +71,6 @@ export class Header extends React.Component {
<span css={styles.screenName}>@{screenName}</span>
</a>
</div>
</div>
</div>
}
}

4 changes: 2 additions & 2 deletions examples/tweet/tweet.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createElement } from '../../src/react' // eslint-disable-line no-unused-vars
/** @jsx createElement */


import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react' // eslint-disable-line no-unused-vars

import { Header } from './header'
import { Content } from './content'
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
"preact": "^7.1.0",
"preact-compat": "^3.9.4",
"pug": "^2.0.0-beta6",
"react": "^15.4.1",
"react-addons-css-transition-group": "^15.4.1",
"react-dom": "^15.4.1",
"react": "^15.5.4",
"react-addons-css-transition-group": "^15.5.2",
"react-dom": "^15.5.4",
"rimraf": "^2.5.4",
"stylelint": "^7.7.0",
"stylelint-config-standard": "^15.0.1",
Expand Down Expand Up @@ -117,6 +117,7 @@
"dependencies": {
"babel-runtime": "^6.18.0",
"fbjs": "^0.8.8",
"object-assign": "^4.1.0"
"object-assign": "^4.1.0",
"prop-types": "^15.5.8"
}
}
7 changes: 4 additions & 3 deletions src/react.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import assign from 'object-assign'
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import { isLikeRule, style, merge } from './index.js'

if(process.env.NODE_ENV === 'development' || !process.env.NODE_ENV) {
console.warn('[Deprecation] In glamor v3 this file will be published as a standalone package: "glamor-react". See https://github.com/threepointone/glamor/issues/204 for more information.')
console.warn('[Deprecation] In glamor v3 this file will be published as a standalone package: "glamor-react". See https://github.com/threepointone/glamor/issues/204 for more information.') // eslint-disable-line no-console
}

export * from './index.js' // convenience
Expand Down Expand Up @@ -125,7 +126,7 @@ export function propMerge(mergeStyle, props) {
}

if (glamorStyleKeys.length > 1) {
console.warn('[glamor] detected multiple data attributes on an element. This may lead to unexpected style because of css insertion order.');
console.warn('[glamor] detected multiple data attributes on an element. This may lead to unexpected style because of css insertion order.') // eslint-disable-line no-console

// just append "mergeStyle" to props, because we dunno in which order glamor styles were added to props
return {
Expand Down
Loading

0 comments on commit b3cbddf

Please sign in to comment.