Commit 1c0368d0 authored by Patrik Meijer's avatar Patrik Meijer
Browse files

eslint --fix

parent 672cf49e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -54,12 +54,12 @@ export default class AttributeEditor extends Component {

    static getDerivedStateFromProps(nextProps, prevState) {
        if (nextProps.selection.length !== Object.keys(prevState.territory).length) {
            return {territory: AttributeEditor.getTerritoryFromSelection(nextProps.selection)}
            return {territory: AttributeEditor.getTerritoryFromSelection(nextProps.selection)};
        }

        for (let i = 0; nextProps.selection.length; i += 1) {
            if (!prevState.territory[nextProps.selection[i]]) {
                return {territory: AttributeEditor.getTerritoryFromSelection(nextProps.selection)}
                return {territory: AttributeEditor.getTerritoryFromSelection(nextProps.selection)};
            }
        }

@@ -68,7 +68,7 @@ export default class AttributeEditor extends Component {

    componentDidMount() {
        this.setState({
            territory: AttributeEditor.getTerritoryFromSelection(this.props.selection)
            territory: AttributeEditor.getTerritoryFromSelection(this.props.selection),
        });
    }

@@ -173,8 +173,8 @@ export default class AttributeEditor extends Component {
                    />);
            });

        const icon = (loadedNodes.length > 0 && this.props.children) ?
            React.Children.map(this.props.children, (child) => {
        const icon = (loadedNodes.length > 0 && this.props.children)
            ? React.Children.map(this.props.children, (child) => {
                const nodeId = selection[0]; // This assumes only one node.
                return React.cloneElement(child, {nodeId});
            })
+3 −3
Original line number Diff line number Diff line
import React, {Component} from 'react';

import AttributeEditor from './index'
import AttributeEditor from './index';

export default class DemoAttributeEditor extends Component {
    constructor(props) {
@@ -17,6 +17,6 @@ export default class DemoAttributeEditor extends Component {
                    fullWidthWidgets
                />
            </div>
        )
        );
    }
}
+28 −22
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ export default class AttributeItem extends Component {
    static getDerivedStateFromProps(nextProps, prevState) {
        // Note that outside property updates have precedence over typed in fields.
        if (nextProps.value !== prevState.persistedValue) {
            return {value: nextProps.value, persistedValue: nextProps.value, picking: false}
            return {value: nextProps.value, persistedValue: nextProps.value, picking: false};
        }

        return null;
@@ -172,36 +172,42 @@ export default class AttributeItem extends Component {

        switch (type) {
            case AttributeTypes.boolean:
                content = (<FormControlLabel
                content = (
                    <FormControlLabel
                        disabled={readonly}
                        control={<Switch checked={value} onChange={this.onChange}/>}
                />);
                    />
                );
                break;
            case AttributeTypes.string:
                content = (<Input
                content = (
                    <Input
                        disabled={readonly}
                        value={value}
                        onChange={this.onChange}
                        onKeyPress={this.onKeyPress}
                        onBlur={this.onBlur}
                />);
                    />
                );
                break;
            case AttributeTypes.number:
                content = (<Input
                content = (
                    <Input
                        disabled={readonly}
                        type="number"
                        value={value}
                        onChange={this.onChange}
                        onKeyPress={this.onKeyPress}
                        onBlur={this.onBlur}
                />);
                    />
                );
                break;
            case AttributeTypes.color:
                content = [];
                content.push(<Input
                    key="input"
                    value={this.state.value}
                    endAdornment={
                    endAdornment={(
                        <InputAdornment position="end">
                            <IconButton onClick={() => {
                                this.setState({picking: !picking});
@@ -210,7 +216,7 @@ export default class AttributeItem extends Component {
                                {picking ? <InvertColorsOff/> : <InvertColors nativeColor={value}/>}
                            </IconButton>
                        </InputAdornment>
                    }
                    )}
                />);

                if (picking) {
+3 −1
Original line number Diff line number Diff line
@@ -66,7 +66,9 @@ export default class BasicConnection extends Component {
    };

    render() {
        const {path, hasWrapper, dashed, color} = this.props;
        const {
            path, hasWrapper, dashed, color,
        } = this.props;
        const box = this.getBoundingBox();
        const sections = [];
        let i;
+17 −14
Original line number Diff line number Diff line
import React, {Component} from 'react';
import Button from '@material-ui/core/Button';

import ConfirmDialog from './index'
import ConfirmDialog from './index';

export default class DemoConfirmDialog extends Component {
    state = {
        openDialog: false
        openDialog: false,
    };

    openDialog = () => {
@@ -23,10 +23,12 @@ export default class DemoConfirmDialog extends Component {
                    onClick={this.openDialog}
                    color="primary"
                >

                    Show Dialog
                </Button>

                {this.state.openDialog ? <ConfirmDialog
                {this.state.openDialog ? (
                    <ConfirmDialog
                        title="A simple Yes/No or OK/Cancel Dialog"
                        message="Note that whenever this dialog is present it will be displayed. Therefore you
                    need to add/remove it from the parent that controls it. Get it?"
@@ -36,8 +38,9 @@ export default class DemoConfirmDialog extends Component {
                            alert(yes ? 'Good' : 'It\'ll be come clear if you look at the source for the demo');
                            this.closeDialog();
                        }}
                /> : null}
                    />
                ) : null}
            </div>
        )
        );
    }
}
Loading