import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Button } from '@redux-devtools/ui';
import { IoIosLock } from 'react-icons/io';
import { lockChanges } from '../../actions';
class LockButton extends Component {
  shouldComponentUpdate(nextProps) {
    return nextProps.locked !== this.props.locked;
  }
  render() {
    return /*#__PURE__*/React.createElement(Button, {
      tooltipPosition: "bottom",
      disabled: this.props.disabled,
      mark: this.props.locked && 'base0D',
      title: this.props.locked ? 'Unlock changes' : 'Lock changes',
      onClick: this.props.lockChanges
    }, /*#__PURE__*/React.createElement(IoIosLock, null));
  }
}
function mapDispatchToProps(dispatch, ownProps) {
  return {
    lockChanges: () => dispatch(lockChanges(!ownProps.locked))
  };
}
export default connect(null, mapDispatchToProps)(LockButton);