"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SidebarToggleButton;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _reactIntl = require("react-intl");
var _classnames = _interopRequireDefault(require("classnames"));
var _SidebarToggleButton = _interopRequireDefault(require("../../../styles/cspace-ui/SidebarToggleButton.css"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const messages = (0, _reactIntl.defineMessages)({
  hide: {
    "id": "sidebarToggleButton.hide",
    "defaultMessage": "Hide sidebar"
  },
  show: {
    "id": "sidebarToggleButton.show",
    "defaultMessage": "Show sidebar"
  }
});
const propTypes = {
  color: _propTypes.default.string,
  isOpen: _propTypes.default.bool,
  toggle: _propTypes.default.func
};
const defaultProps = {
  color: 'black',
  isOpen: true
};
function SidebarToggleButton(props) {
  const {
    color,
    isOpen,
    toggle
  } = props;
  const className = (0, _classnames.default)(isOpen ? _SidebarToggleButton.default.normal : _SidebarToggleButton.default.closed, _SidebarToggleButton.default[color]);
  const labelMessage = isOpen ? messages.hide : messages.show;
  return /*#__PURE__*/_react.default.createElement("button", {
    className: className,
    name: "toggleSidebar",
    type: "button",
    onClick: toggle
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, labelMessage));
}
SidebarToggleButton.propTypes = propTypes;
SidebarToggleButton.defaultProps = defaultProps;