@darwino/darwino-react
Version:
A set of Javascript classes and utilities
48 lines (43 loc) • 1.04 kB
JavaScript
/*
* (c) Copyright Darwino Inc. 2014-2017.
*/
import React from 'react';
import { values as valuesDecorator } from 'redux-form';
/*
* Used to debug the content of a JSON document, particularly within a form
* Usage
* <JsonDebug form={this.props.form}/>
*/
var JsonDebug = (_ref) => {
var {
form,
value
} = _ref;
if (form) {
var decorator = valuesDecorator({
form
});
var component = (_ref2) => {
var {
values
} = _ref2;
return /*#__PURE__*/React.createElement("pre", {
style: {
'marginTop': '1em',
'marginBottom': '1em'
}
}, JSON.stringify(values, null, 2));
};
var Decorated = decorator(component);
return /*#__PURE__*/React.createElement(Decorated, null);
} else {
return /*#__PURE__*/React.createElement("pre", {
style: {
'marginTop': '1em',
'marginBottom': '1em'
}
}, JSON.stringify(value, null, 2));
}
};
export default JsonDebug;
//# sourceMappingURL=JsonDebug.js.map