"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = Variables;

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

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

var _componentGroups = _interopRequireDefault(require("../../docs-utils/componentGroups"));

var _componentCategories = _interopRequireDefault(require("../../docs-utils/componentCategories"));

var _index = _interopRequireDefault(require("../../interal-variables/index"));

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function Variables(props) {
  var _ref = _index["default"][props.type] || {},
      propertyName = _ref.propertyName,
      propertyType = _ref.propertyType,
      propertyStyle = _ref.propertyStyle,
      propertyList = _ref.propertyList,
      propertyDisplayName = _ref.propertyDisplayName,
      propertyFilter = _ref.propertyFilter;

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, Object.keys(propertyList).map(function (item, index) {
    if (propertyFilter && !propertyFilter(item, propertyType)) {
      return null;
    }

    var itemValue = propertyList[item];
    var displayName = propertyDisplayName.replace("{0}", itemValue);
    return /*#__PURE__*/_react["default"].createElement("div", {
      title: displayName,
      key: index,
      className: propertyStyle,
      style: _defineProperty({}, propertyName, itemValue)
    }, props.content);
  }));
}

Variables.propTypes = {
  type: _propTypes["default"].string
};

if (false) {
  Variables.docs = {
    componentGroup: _componentGroups["default"].Atom,
    folderName: _componentCategories["default"].General
  };
}