Remove CRA stuff, revert to custom webpack config
This commit is contained in:
4
client/.babelrc
Normal file
4
client/.babelrc
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"presets": ["env", "react", "stage-2"],
|
||||
"plugins": []
|
||||
}
|
||||
14
client/.eslintrc
Normal file
14
client/.eslintrc
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"parser": "babel-eslint",
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"react/no-children-prop": 0
|
||||
}
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { parseNumber, formatNumber } from "./NumberUtils"
|
||||
|
||||
class NumberTextInput extends React.Component {
|
||||
static propTypes = {
|
||||
value: PropTypes.number,
|
||||
parseNumber: PropTypes.func,
|
||||
formatNumber: PropTypes.func,
|
||||
onChange: PropTypes.func
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
value: 0,
|
||||
parseNumber,
|
||||
formatNumber
|
||||
}
|
||||
|
||||
state = {
|
||||
value: null
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.setState({ value: this.props.value })
|
||||
}
|
||||
|
||||
handleChange = event => {
|
||||
const value = this.props.parseNumber(event.target.value)
|
||||
|
||||
this.setState({ value }, () => {
|
||||
if (this.props.onChange) this.props.onChange(value)
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { value } = this.state
|
||||
const { parseNumber, formatNumber, ...props } = this.props // eslint-disable-line no-unused-vars
|
||||
const displayValue = formatNumber(value)
|
||||
|
||||
return <input {...props} type="text" value={displayValue} onChange={this.handleChange} />
|
||||
}
|
||||
}
|
||||
|
||||
export default NumberTextInput
|
||||
10
client/index.html
Normal file
10
client/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
@ -3,4 +3,4 @@ import ReactDOM from "react-dom"
|
||||
import App from "./App"
|
||||
import "./index.css"
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById("root"))
|
||||
ReactDOM.render(<App />, document.getElementById("app"))
|
||||
|
||||
Reference in New Issue
Block a user