import _get from "lodash/fp/get";
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import PropTypes from 'prop-types';
import Provider from '../../atom/provider';
import InputSwitch from '../../atom/input-switch';
import RadioGroup from '../../atom/radio-group';
import { COLORS } from '../../variables/colors';
import style from './style.css';
const ContentTypesToggler = (props, context) => {
  const {
    skin
  } = context;
  const {
    contentTypes
  } = props;
  if (!contentTypes) {
    return null;
  }
  const brand = _get('common.brand', skin);
  const orange = _get('common.orange', skin);
  const contentTypesColor = _get('modified', contentTypes) ? orange : brand;
  return /*#__PURE__*/React.createElement("div", {
    className: style.contentTypeWrapper
  }, /*#__PURE__*/React.createElement(RadioGroup, _extends({}, contentTypes, {
    style: {
      color: contentTypesColor
    },
    color: COLORS.cm_primary_blue
  })));
};
ContentTypesToggler.contextTypes = {
  skin: Provider.childContextTypes.skin
};
ContentTypesToggler.propTypes = process.env.NODE_ENV !== "production" ? {
  contentTypes: PropTypes.shape({
    ...RadioGroup.propTypes,
    modified: PropTypes.bool
  })
} : {};
const SetupSection = (props, context) => {
  const {
    translate
  } = context;
  const {
    title,
    display,
    contentTypes
  } = props;
  return /*#__PURE__*/React.createElement("div", {
    className: style.wrapper
  }, /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, title), /*#__PURE__*/React.createElement("div", {
    className: style.settings
  }, /*#__PURE__*/React.createElement(ContentTypesToggler, {
    contentTypes: contentTypes
  }), /*#__PURE__*/React.createElement("div", {
    className: style.label
  }, translate('Show')), /*#__PURE__*/React.createElement(InputSwitch, display)));
};
SetupSection.contextTypes = {
  translate: Provider.childContextTypes.translate,
  skin: Provider.childContextTypes.skin
};
SetupSection.propTypes = process.env.NODE_ENV !== "production" ? {
  title: PropTypes.string.isRequired,
  onUp: PropTypes.func,
  onDown: PropTypes.func,
  display: PropTypes.shape(InputSwitch.propTypes),
  contentTypes: ContentTypesToggler.propTypes.contentTypes
} : {};
export default SetupSection;
//# sourceMappingURL=index.js.map