eliminate prop type and validation console warnings
This commit is contained in:
parent
22017b4411
commit
051257aa12
@ -7,7 +7,7 @@ import { Icon, Toast } from 'UI';
|
||||
export default class AuthenticationPage extends React.Component {
|
||||
static propTypes = {
|
||||
onLogin: PropTypes.func.isRequired,
|
||||
inProgress: PropTypes.bool.isRequired,
|
||||
inProgress: PropTypes.bool,
|
||||
};
|
||||
|
||||
state = {};
|
||||
|
@ -5,7 +5,7 @@ import { Icon } from 'UI';
|
||||
export default class AuthenticationPage extends React.Component {
|
||||
static propTypes = {
|
||||
onLogin: PropTypes.func.isRequired,
|
||||
inProgress: PropTypes.bool.isRequired,
|
||||
inProgress: PropTypes.bool,
|
||||
};
|
||||
|
||||
handleLogin = (e) => {
|
||||
|
@ -57,7 +57,6 @@ class Editor extends React.Component {
|
||||
showDelete: PropTypes.bool.isRequired,
|
||||
openMediaLibrary: PropTypes.func.isRequired,
|
||||
removeInsertedMedia: PropTypes.func.isRequired,
|
||||
closeEntry: PropTypes.func.isRequired,
|
||||
fields: ImmutablePropTypes.list.isRequired,
|
||||
slug: PropTypes.string,
|
||||
newEntry: PropTypes.bool.isRequired,
|
||||
|
@ -13,7 +13,6 @@ export default class Widget extends Component {
|
||||
hasActiveStyle: PropTypes.bool,
|
||||
setActiveStyle: PropTypes.func.isRequired,
|
||||
setInactiveStyle: PropTypes.func.isRequired,
|
||||
className: PropTypes.string.isRequired,
|
||||
classNameWrapper: PropTypes.string.isRequired,
|
||||
classNameWidget: PropTypes.string.isRequired,
|
||||
classNameWidgetActive: PropTypes.string.isRequired,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { List, Map, fromJS } from 'immutable';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { List, Map, fromJS } from 'immutable';
|
||||
import { partial } from 'lodash';
|
||||
import c from 'classnames';
|
||||
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||
@ -48,7 +48,10 @@ export default class ListControl extends Component {
|
||||
static propTypes = {
|
||||
onChange: PropTypes.func.isRequired,
|
||||
onChangeObject: PropTypes.func.isRequired,
|
||||
value: PropTypes.node,
|
||||
value: PropTypes.oneOfType([
|
||||
ImmutablePropTypes.list,
|
||||
PropTypes.string,
|
||||
]),
|
||||
field: PropTypes.node,
|
||||
forID: PropTypes.string,
|
||||
mediaPaths: ImmutablePropTypes.map.isRequired,
|
||||
|
@ -151,8 +151,8 @@ export default class Toolbar extends React.Component {
|
||||
/>
|
||||
}
|
||||
>
|
||||
{plugins && plugins.toList().map(plugin => (
|
||||
<DropdownItem label={plugin.get('label')} onClick={() => onSubmit(plugin.get('id'))} />
|
||||
{plugins && plugins.toList().map((plugin, idx) => (
|
||||
<DropdownItem key={idx} label={plugin.get('label')} onClick={() => onSubmit(plugin.get('id'))} />
|
||||
))}
|
||||
</Dropdown>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@ const ToolbarButton = ({ type, label, icon, onClick, isActive, disabled }) => {
|
||||
return (
|
||||
<button
|
||||
className={c('nc-toolbarButton-button', { ['nc-toolbarButton-active']: active })}
|
||||
onClick={e => onClick(e, type)}
|
||||
onClick={e => onClick && onClick(e, type)}
|
||||
title={label}
|
||||
disabled={disabled}
|
||||
>
|
||||
@ -22,7 +22,7 @@ ToolbarButton.propTypes = {
|
||||
type: PropTypes.string,
|
||||
label: PropTypes.string.isRequired,
|
||||
icon: PropTypes.string,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
onClick: PropTypes.func,
|
||||
isActive: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ export default class MarkdownControl extends React.Component {
|
||||
onAddAsset: PropTypes.func.isRequired,
|
||||
getAsset: PropTypes.func.isRequired,
|
||||
classNameWrapper: PropTypes.string.isRequired,
|
||||
editorControl: PropTypes.node.isRequired,
|
||||
editorControl: PropTypes.func.isRequired,
|
||||
value: PropTypes.string,
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ export default class ObjectControl extends Component {
|
||||
return true;
|
||||
}
|
||||
|
||||
controlFor(field) {
|
||||
controlFor(field, key) {
|
||||
const {
|
||||
onAddAsset,
|
||||
onOpenMediaLibrary,
|
||||
@ -72,6 +72,7 @@ export default class ObjectControl extends Component {
|
||||
|
||||
return (
|
||||
<EditorControl
|
||||
key={key}
|
||||
field={field}
|
||||
value={fieldValue}
|
||||
mediaPaths={mediaPaths}
|
||||
@ -91,7 +92,7 @@ export default class ObjectControl extends Component {
|
||||
|
||||
if (multiFields) {
|
||||
return (<div id={forID} className={c(classNameWrapper, 'nc-objectControl-root')}>
|
||||
{multiFields.map(f => this.controlFor(f))}
|
||||
{multiFields.map((f, idx) => this.controlFor(f, idx))}
|
||||
</div>);
|
||||
} else if (singleField) {
|
||||
return this.controlFor(singleField);
|
||||
|
@ -26,7 +26,7 @@ export default class TextControl extends React.Component {
|
||||
render() {
|
||||
const {
|
||||
forID,
|
||||
value = '',
|
||||
value,
|
||||
onChange,
|
||||
classNameWrapper,
|
||||
setActiveStyle,
|
||||
@ -36,7 +36,7 @@ export default class TextControl extends React.Component {
|
||||
return (
|
||||
<Textarea
|
||||
id={forID}
|
||||
value={value}
|
||||
value={value || ''}
|
||||
className={classNameWrapper}
|
||||
onFocus={setActiveStyle}
|
||||
onBlur={setInactiveStyle}
|
||||
|
@ -10,6 +10,10 @@ export class Modal extends React.Component {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
ReactModal.setAppElement('#nc-root');
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isOpen, children, className, onClose } = this.props;
|
||||
return (
|
||||
@ -20,6 +24,7 @@ export class Modal extends React.Component {
|
||||
className={{
|
||||
base: `nc-modal-body ${className || ''}`,
|
||||
afterOpen: 'nc-modal-body-opening',
|
||||
beforeClose: '',
|
||||
}}
|
||||
overlayClassName={{
|
||||
base: 'nc-modal-overlay',
|
||||
|
Loading…
x
Reference in New Issue
Block a user