Dashboard sipadu mbip
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

GridLoader.js 4.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. "use strict";
  2. var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
  3. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  4. return cooked;
  5. };
  6. var __extends = (this && this.__extends) || (function () {
  7. var extendStatics = function (d, b) {
  8. extendStatics = Object.setPrototypeOf ||
  9. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11. return extendStatics(d, b);
  12. };
  13. return function (d, b) {
  14. extendStatics(d, b);
  15. function __() { this.constructor = d; }
  16. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17. };
  18. })();
  19. var __importStar = (this && this.__importStar) || function (mod) {
  20. if (mod && mod.__esModule) return mod;
  21. var result = {};
  22. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  23. result["default"] = mod;
  24. return result;
  25. };
  26. Object.defineProperty(exports, "__esModule", { value: true });
  27. /** @jsx jsx */
  28. var React = __importStar(require("react"));
  29. var core_1 = require("@emotion/core");
  30. var helpers_1 = require("./helpers");
  31. var grid = core_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {transform: scale(1)}\n 50% {transform: scale(0.5); opacity: 0.7}\n 100% {transform: scale(1);opacity: 1}\n"], ["\n 0% {transform: scale(1)}\n 50% {transform: scale(0.5); opacity: 0.7}\n 100% {transform: scale(1);opacity: 1}\n"])));
  32. var random = function (top) { return Math.random() * top; };
  33. var Loader = /** @class */ (function (_super) {
  34. __extends(Loader, _super);
  35. function Loader() {
  36. var _this = _super !== null && _super.apply(this, arguments) || this;
  37. _this.style = function (rand) {
  38. var _a = _this.props, color = _a.color, size = _a.size, sizeUnit = _a.sizeUnit, margin = _a.margin;
  39. return core_1.css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-block;\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: 100%;\n animation-fill-mode: \"both\";\n animation: ", " ", "s ", "s infinite ease;\n "], ["\n display: inline-block;\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: 100%;\n animation-fill-mode: \"both\";\n animation: ", " ", "s ", "s infinite ease;\n "])), color, "" + size + sizeUnit, "" + size + sizeUnit, margin, grid, rand / 100 + 0.6, rand / 100 - 0.2);
  40. };
  41. _this.wrapper = function () {
  42. var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit, margin = _a.margin;
  43. return core_1.css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n font-size: 0;\n "], ["\n width: ", ";\n font-size: 0;\n "])), "" + (parseFloat(size.toString()) * 3 + parseFloat(margin) * 6) + sizeUnit);
  44. };
  45. return _this;
  46. }
  47. Loader.prototype.render = function () {
  48. var _a = this.props, loading = _a.loading, css = _a.css;
  49. return loading ? (core_1.jsx("div", { css: [this.wrapper(), css] },
  50. core_1.jsx("div", { css: this.style(random(100)) }),
  51. core_1.jsx("div", { css: this.style(random(100)) }),
  52. core_1.jsx("div", { css: this.style(random(100)) }),
  53. core_1.jsx("div", { css: this.style(random(100)) }),
  54. core_1.jsx("div", { css: this.style(random(100)) }),
  55. core_1.jsx("div", { css: this.style(random(100)) }),
  56. core_1.jsx("div", { css: this.style(random(100)) }),
  57. core_1.jsx("div", { css: this.style(random(100)) }),
  58. core_1.jsx("div", { css: this.style(random(100)) }))) : null;
  59. };
  60. Loader.defaultProps = helpers_1.sizeMarginDefaults(15);
  61. return Loader;
  62. }(React.PureComponent));
  63. exports.default = Loader;
  64. var templateObject_1, templateObject_2, templateObject_3;