"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _netlifyCmsUiDefault = require("netlify-cms-ui-default");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const EditorToggleButton = (0, _styledBase.default)("button", {
  target: "emetehf0",
  label: "EditorToggleButton"
})(_netlifyCmsUiDefault.buttons.button, ";", _netlifyCmsUiDefault.shadows.dropMiddle, ";background-color:", _netlifyCmsUiDefault.colorsRaw.white, ";color:", props => _netlifyCmsUiDefault.colors[props.isActive ? "active" : "inactive"], ";border-radius:32px;display:flex;justify-content:center;align-items:center;width:40px;height:40px;padding:0;margin-bottom:12px;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0VkaXRvci9FZGl0b3JUb2dnbGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS3dDIiwiZmlsZSI6Ii4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0VkaXRvci9FZGl0b3JUb2dnbGUuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IFByb3BUeXBlcyBmcm9tICdwcm9wLXR5cGVzJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IEljb24sIGNvbG9ycywgY29sb3JzUmF3LCBzaGFkb3dzLCBidXR0b25zIH0gZnJvbSAnbmV0bGlmeS1jbXMtdWktZGVmYXVsdCc7XG5cbmNvbnN0IEVkaXRvclRvZ2dsZUJ1dHRvbiA9IHN0eWxlZC5idXR0b25gXG4gICR7YnV0dG9ucy5idXR0b259O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HJpbmcuaXNSZXF1aXJlZCxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IEVkaXRvclRvZ2dsZTtcbiJdfQ== */"));

const EditorToggle = (_ref) => {
  let {
    enabled,
    active,
    onClick,
    icon
  } = _ref;
  return !enabled ? null : _react.default.createElement(EditorToggleButton, {
    onClick: onClick,
    isActive: active
  }, (icon == 'mobile' || icon == 'display') && _react.default.createElement(_netlifyCmsUiDefault.Icon, {
    type: icon,
    size: "medium"
  }), !(icon == 'mobile' || icon == 'display') && _react.default.createElement(_netlifyCmsUiDefault.Icon, {
    type: icon,
    size: "large"
  }));
};

EditorToggle.propTypes = {
  enabled: _propTypes.default.bool,
  active: _propTypes.default.bool,
  onClick: _propTypes.default.func.isRequired,
  icon: _propTypes.default.string.isRequired
};
var _default = EditorToggle;
exports.default = _default;