@vtex/styleguide
Version:
> VTEX Styleguide React components ([Docs](https://vtex.github.io/styleguide))
75 lines (59 loc) • 2.19 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
var EmptyState =
/*#__PURE__*/
function (_PureComponent) {
_inheritsLoose(EmptyState, _PureComponent);
function EmptyState() {
return _PureComponent.apply(this, arguments) || this;
}
var _proto = EmptyState.prototype;
_proto.render = function render() {
var _this$props = this.props,
children = _this$props.children,
height = _this$props.height,
testId = _this$props.testId,
title = _this$props.title;
return _react2.default.createElement("div", {
className: "flex items-center h-100 c-muted-2",
"data-testid": testId,
style: {
height: height
}
}, _react2.default.createElement("div", {
className: "w-80 w-60-l center tc"
}, title && _react2.default.createElement("span", {
className: "t-heading-4 mt0"
}, title), children && _react2.default.createElement("div", {
className: "t-body lh-copy"
}, children)));
};
return EmptyState;
}(_react.PureComponent);
EmptyState.propTypes = {
/** Title of the component (String) */
title: function title(props, propName, componentName) {
if (!props.title && !props.children) {
return new Error("Prop 'title' or 'children' was not specified in '" + componentName + "'.");
}
},
/** node */
children: function children(props, propName, componentName) {
if (!props.title && !props.children) {
return new Error("Prop 'title' or 'children' was not specified in '" + componentName + "'.");
}
},
/** Data attribute */
testId: _propTypes2.default.string,
/** Component's height */
height: _propTypes2.default.number
};
exports.default = EmptyState;