UNPKG

2.13 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _react = _interopRequireDefault(require("react"));
9
10var _propTypes = _interopRequireDefault(require("prop-types"));
11
12var _withStyles = require("../helpers/withStyles");
13
14var _Text = _interopRequireDefault(require("./Text"));
15
16var _Shimmer = _interopRequireDefault(require("./Shimmer"));
17
18function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20var propTypes = {
21 color: _propTypes.default.string,
22 loading: _propTypes.default.bool,
23 text: _propTypes.default.string
24};
25
26var StatusIndicator = function StatusIndicator(_ref) {
27 var text = _ref.text,
28 color = _ref.color,
29 css = _ref.css,
30 loading = _ref.loading,
31 styles = _ref.styles;
32 return _react.default.createElement("span", css(styles.label), _react.default.createElement("div", css(styles.label__color, {
33 backgroundColor: color
34 }), loading && _react.default.createElement("div", css(styles.label__color__shimmer), _react.default.createElement(_Shimmer.default, {
35 width: "100%",
36 height: "100%"
37 }))), _react.default.createElement(_Text.default, {
38 small: true,
39 shimmerWidth: "3rem",
40 loading: loading
41 }, text));
42};
43
44StatusIndicator.propTypes = propTypes;
45var StatusIndicatorWithStyles = (0, _withStyles.withStyles)(function (_ref2) {
46 var color = _ref2.color,
47 animation = _ref2.animation,
48 units = _ref2.units;
49 return {
50 label: {
51 display: 'flex',
52 alignItems: 'center',
53 flexShrink: 0
54 },
55 label__color: {
56 //backgroundColor: color.blueGrayDark,
57 width: units(.625),
58 height: units(.625),
59 borderRadius: '50%',
60 marginRight: units(0.5),
61 flexShrink: 0,
62 position: 'relative',
63 overflow: 'hidden'
64 },
65 label__color__shimmer: {
66 display: 'flex',
67 position: 'absolute',
68 width: '100%',
69 height: '100%',
70 top: 0,
71 right: 0,
72 bottom: 0,
73 left: 0
74 }
75 };
76})(StatusIndicator);
77var _default = StatusIndicatorWithStyles;
78exports.default = _default;
\No newline at end of file