Skip to content

Commit

Permalink
change Children array to Fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
Conglei Shi committed Sep 12, 2018
1 parent 8e98b79 commit 2dd4c69
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions superset/assets/src/components/ModalTrigger.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Modal, MenuItem } from 'react-bootstrap';
import cx from 'classnames';
Expand Down Expand Up @@ -82,31 +82,37 @@ export default class ModalTrigger extends React.Component {
'btn btn-default btn-sm': this.props.isButton,
});
if (this.props.isButton) {
return [
<Button
className="modal-trigger"
tooltip={this.props.tooltip}
onClick={this.open}
>
{this.props.triggerNode}
</Button>,
this.renderModal(),
];
return (
<Fragment>
<Button
className="modal-trigger"
tooltip={this.props.tooltip}
onClick={this.open}
>
{this.props.triggerNode}
</Button>
{this.renderModal()}
</Fragment>
);
} else if (this.props.isMenuItem) {
return [
<MenuItem onClick={this.open}>
{this.props.triggerNode}
</MenuItem>,
this.renderModal(),
];
return (
<Fragment>
<MenuItem onClick={this.open}>
{this.props.triggerNode}
</MenuItem>
{this.renderModal()}
</Fragment>
);
}
/* eslint-disable jsx-a11y/interactive-supports-focus */
return [
<span className={classNames} onClick={this.open} role="button">
{this.props.triggerNode}
</span>,
this.renderModal(),
];
return (
<Fragment>
<span className={classNames} onClick={this.open} role="button">
{this.props.triggerNode}
</span>
{this.renderModal()}
</Fragment>
);
}
}

Expand Down

0 comments on commit 2dd4c69

Please sign in to comment.