Unify proptypes in util/proptypes.js (#3728)

* Unify proptypes in util/proptypes.js

* Add missing use of nodeOrStringProptype
This commit is contained in:
Jaco Greeff
2016-12-07 10:25:57 +01:00
committed by GitHub
parent 60680e1913
commit e2bb8ef6d1
15 changed files with 70 additions and 45 deletions

View File

@@ -21,6 +21,9 @@ const muiTheme = getMuiTheme(lightBaseTheme);
import CircularProgress from 'material-ui/CircularProgress';
import { Card, CardText } from 'material-ui/Card';
import { nullableProptype } from '~/util/proptypes';
import styles from './application.css';
import Accounts from '../Accounts';
import Events from '../Events';
@@ -28,8 +31,6 @@ import Lookup from '../Lookup';
import Names from '../Names';
import Records from '../Records';
const nullable = (type) => React.PropTypes.oneOfType([ React.PropTypes.oneOf([ null ]), type ]);
export default class Application extends Component {
static childContextTypes = {
muiTheme: PropTypes.object.isRequired,
@@ -44,8 +45,8 @@ export default class Application extends Component {
actions: PropTypes.object.isRequired,
accounts: PropTypes.object.isRequired,
contacts: PropTypes.object.isRequired,
contract: nullable(PropTypes.object.isRequired),
fee: nullable(PropTypes.object.isRequired),
contract: nullableProptype(PropTypes.object.isRequired),
fee: nullableProptype(PropTypes.object.isRequired),
lookup: PropTypes.object.isRequired,
events: PropTypes.object.isRequired,
names: PropTypes.object.isRequired,

View File

@@ -18,19 +18,19 @@ import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { nullableProptype } from '~/util/proptypes';
import Application from './Application';
import * as actions from './actions';
const nullable = (type) => React.PropTypes.oneOfType([ React.PropTypes.oneOf([ null ]), type ]);
class Container extends Component {
static propTypes = {
actions: PropTypes.object.isRequired,
accounts: PropTypes.object.isRequired,
contacts: PropTypes.object.isRequired,
contract: nullable(PropTypes.object.isRequired),
owner: nullable(PropTypes.string.isRequired),
fee: nullable(PropTypes.object.isRequired),
contract: nullableProptype(PropTypes.object.isRequired),
owner: nullableProptype(PropTypes.string.isRequired),
fee: nullableProptype(PropTypes.object.isRequired),
lookup: PropTypes.object.isRequired,
events: PropTypes.object.isRequired
};

View File

@@ -19,21 +19,22 @@ import { Card, CardHeader, CardText } from 'material-ui/Card';
import TextField from 'material-ui/TextField';
import RaisedButton from 'material-ui/RaisedButton';
import SearchIcon from 'material-ui/svg-icons/action/search';
import { nullableProptype } from '~/util/proptypes';
import renderAddress from '../ui/address.js';
import renderImage from '../ui/image.js';
import recordTypeSelect from '../ui/record-type-select.js';
import styles from './lookup.css';
const nullable = (type) => React.PropTypes.oneOfType([ React.PropTypes.oneOf([ null ]), type ]);
export default class Lookup extends Component {
static propTypes = {
actions: PropTypes.object.isRequired,
name: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
result: nullable(PropTypes.string.isRequired),
result: nullableProptype(PropTypes.string.isRequired),
accounts: PropTypes.object.isRequired,
contacts: PropTypes.object.isRequired
}