@compositor/kit
Version:
Components for development environments, style guides, and demos
44 lines (33 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.withDebug = exports.Debug = undefined;
var _stringify = require('babel-runtime/core-js/json/stringify');
var _stringify2 = _interopRequireDefault(_stringify);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Debug = exports.Debug = function Debug(_ref) {
var children = _ref.children,
log = _ref.log;
if (log) {
console.log(children);
}
return _react2.default.createElement('pre', {
style: {
maxHeight: '400px',
backgroundColor: '#fafafa',
padding: '20px',
overflowX: 'scroll',
whiteSpace: 'pre-wrap'
},
children: (0, _stringify2.default)(children, null, 2)
});
};
var withDebug = exports.withDebug = function withDebug(Component) {
return function (props) {
console.log(props);
return _react2.default.createElement(Component, props);
};
};