Switching to @Radium decorator

This commit is contained in:
John Lyon-Smith
2018-03-22 15:27:12 -07:00
parent 06ae76047e
commit 1b35ac8b22
32 changed files with 115 additions and 122 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import { reactAutoBind } from 'auto-bind2'
import autobind from 'autobind-decorator'
import { regExpPattern } from 'regexp-pattern'
import { api } from 'src/API'
import { Row, Column, BoundInput, BoundButton, BoundCheckbox, BoundEmailIcon } from 'ui'
@@ -65,7 +65,6 @@ export class UserForm extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = {
binder: new FormBinder(this.props.user, UserForm.bindings, this.props.onModifiedChanged)
}
@@ -79,6 +78,7 @@ export class UserForm extends React.Component {
}
}
@autobind
handleSubmit(e) {
e.preventDefault()
@@ -89,6 +89,7 @@ export class UserForm extends React.Component {
}
}
@autobind
handleReset() {
const { user, onModifiedChanged } = this.props
@@ -99,10 +100,12 @@ export class UserForm extends React.Component {
}
}
@autobind
handleChangeEmail() {
this.props.onChangeEmail()
}
@autobind
handleResendEmail() {
this.props.onResendEmail()
}

View File

@@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react'
import PropTypes from 'prop-types'
import { reactAutoBind } from 'auto-bind2'
import autobind from 'autobind-decorator'
import { UserList } from './UserList'
import { UserForm } from './UserForm'
import { UserFormPlaceholder } from './UserFormPlaceholder'
@@ -16,7 +16,6 @@ export class Users extends Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = {
modified: false,
selectedUser: null,
@@ -57,6 +56,7 @@ export class Users extends Component {
}
}
@autobind
handleUserListClick(e, index) {
let user = this.state.users[index]
@@ -74,6 +74,7 @@ export class Users extends Component {
}
}
@autobind
handleSave(user) {
if (user._id) {
this.setState({ waitModal: { message: 'Updating User' } })
@@ -118,10 +119,12 @@ export class Users extends Component {
}
}
@autobind
handleChangeEmail() {
this.setState({ changeEmailModal: { oldEmail: this.state.selectedUser.email } })
}
@autobind
handleResendEmail() {
this.setState({
waitModal: { message: 'Resending Email...' }
@@ -147,6 +150,7 @@ export class Users extends Component {
})
}
@autobind
handleChangeEmailDismiss(newEmail) {
this.setState({ changeEmailModal: null })
if (!newEmail) {
@@ -178,6 +182,7 @@ export class Users extends Component {
}
}
@autobind
handleRemove() {
this.setState({
yesNoModal: {
@@ -187,6 +192,7 @@ export class Users extends Component {
})
}
@autobind
handleRemoveModalDismiss(yes) {
if (yes) {
// TODO: Pass the _id back from the dialog input data
@@ -219,6 +225,7 @@ export class Users extends Component {
})
}
@autobind
handleModifiedModalDismiss(yes) {
if (yes) {
this.setState({
@@ -234,14 +241,17 @@ export class Users extends Component {
})
}
@autobind
handleMessageModalDismiss() {
this.setState({ messageModal: null })
}
@autobind
handleModifiedChanged(modified) {
this.setState({ modified: modified })
}
@autobind
handleAddNewUser() {
let newUser = {}
let newUsers = [newUser].concat(this.state.users)