Rewrite frontend using create-react-app

This commit is contained in:
MICHAEL JACKSON
2017-03-25 23:53:54 -07:00
parent 69a578fcda
commit 0f5c584104
60 changed files with 20489 additions and 18930 deletions

32
client/WindowSize.js Normal file
View File

@ -0,0 +1,32 @@
import React, { PropTypes } from 'react'
import { addEvent, removeEvent } from './DOMUtils'
const ResizeEvent = 'resize'
class WindowSize extends React.Component {
static propTypes = {
onChange: PropTypes.func
}
handleWindowResize = () => {
if (this.props.onChange)
this.props.onChange({
width: window.innerWidth,
height: window.innerHeight
})
}
componentDidMount() {
addEvent(window, ResizeEvent, this.handleWindowResize)
}
componentWillUnmount() {
removeEvent(window, ResizeEvent, this.handleWindowResize)
}
render() {
return null
}
}
export default WindowSize