Skip to content

Commit

Permalink
feat(RemediationsButton): Allow passing props for button
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian committed Aug 17, 2021
1 parent b3c2a6d commit 62026e7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/remediations/src/RemediationButton/RemediationButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ class RemediationButton extends React.Component {
}

render() {
const { children, buttonProps } = this.props;

if (this.state.remediations && !this.state.hasPermission) {
return (
<Tooltip
content="You do not have correct permissions to remediate this entity."
>
<span>
<Button isDisabled>
{ this.props.children }
<Button isDisabled { ...buttonProps }>
{ children }
</Button>
</span>
</Tooltip>
Expand All @@ -60,8 +62,10 @@ class RemediationButton extends React.Component {
<React.Fragment>
<Button
isDisabled={ this.props.isDisabled || this.state.remediations === false }
onClick={ this.onClick } >
{ this.props.children }
onClick={ this.onClick }
{ ...buttonProps }
>
{ children }
</Button>

{ this.state.remediations.RemediationWizard && <this.state.remediations.RemediationWizard /> }
Expand All @@ -74,7 +78,8 @@ RemediationButton.propTypes = {
isDisabled: propTypes.bool,
dataProvider: propTypes.func.isRequired,
onRemediationCreated: propTypes.func,
children: propTypes.node
children: propTypes.node,
buttonProps: propTypes.object
};

RemediationButton.defaultProps = {
Expand Down

0 comments on commit 62026e7

Please sign in to comment.