"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

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

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

var normalizeSize = function normalizeSize(size) {
  return typeof size === 'string' ? size : typeof size === 'number' ? "".concat(size, "px") : '30px';
};

exports.normalizeSize = normalizeSize;

var Sized = function Sized(_ref) {
  var size = _ref.size,
      children = _ref.children;
  size = normalizeSize(size);
  var style = {
    height: size,
    width: size,
    display: 'inline-block',
    position: 'relative'
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: style
  }, children);
};

Sized.propTypes = {
  size: _propTypes["default"].number,
  children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
};
var _default = Sized;
exports["default"] = _default;
//# sourceMappingURL=sized.js.map