Dashboard sipadu mbip
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

HashLoader.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
  16. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  17. return cooked;
  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 index_1 = require("./helpers/index");
  31. var Loader = /** @class */ (function (_super) {
  32. __extends(Loader, _super);
  33. function Loader() {
  34. var _this = _super !== null && _super.apply(this, arguments) || this;
  35. _this.thickness = function () {
  36. var size = _this.props.size;
  37. return size / 5;
  38. };
  39. _this.lat = function () {
  40. var size = _this.props.size;
  41. return (size - _this.thickness()) / 2;
  42. };
  43. _this.offset = function () { return _this.lat() - _this.thickness(); };
  44. _this.color = function () {
  45. var color = _this.props.color;
  46. return index_1.calculateRgba(color, 0.75);
  47. };
  48. _this.before = function () {
  49. var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
  50. var color = _this.color();
  51. var lat = _this.lat();
  52. var thickness = _this.thickness();
  53. var offset = _this.offset();
  54. return core_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {width: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 35% {width: ", ";box-shadow: 0 ", "px ", ", 0 ", "px ", "}\n 70% {width: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 100% {box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n "], ["\n 0% {width: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 35% {width: ", ";box-shadow: 0 ", "px ", ", 0 ", "px ", "}\n 70% {width: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 100% {box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n "])), thickness, lat, -offset, color, -lat, offset, color, "" + size + sizeUnit, -offset, color, offset, color, thickness, -lat, -offset, color, lat, offset, color, lat, -offset, color, -lat, offset, color);
  55. };
  56. _this.after = function () {
  57. var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
  58. var color = _this.color();
  59. var lat = _this.lat();
  60. var thickness = _this.thickness();
  61. var offset = _this.offset();
  62. return core_1.keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {height: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 35% {height: ", ";box-shadow: ", "px 0 ", ", ", "px 0 ", "}\n 70% {height: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 100% {box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n "], ["\n 0% {height: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 35% {height: ", ";box-shadow: ", "px 0 ", ", ", "px 0 ", "}\n 70% {height: ", "px;box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n 100% {box-shadow: ", "px ", "px ", ", ", "px ", "px ", "}\n "])), thickness, offset, lat, color, -offset, -lat, color, "" + size + sizeUnit, offset, color, -offset, color, thickness, offset, -lat, color, -offset, lat, color, offset, lat, color, -offset, -lat, color);
  63. };
  64. _this.style = function (i) {
  65. var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
  66. return core_1.css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n content: \"\";\n top: 50%;\n left: 50%;\n display: block;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n transform: translate(-50%, -50%);\n animation-fill-mode: none;\n animation: ", " 2s infinite;\n "], ["\n position: absolute;\n content: \"\";\n top: 50%;\n left: 50%;\n display: block;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n transform: translate(-50%, -50%);\n animation-fill-mode: none;\n animation: ", " 2s infinite;\n "])), "" + size / 5 + sizeUnit, "" + size / 5 + sizeUnit, "" + size / 10 + sizeUnit, i === 1 ? _this.before() : _this.after());
  67. };
  68. _this.wrapper = function () {
  69. var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
  70. return core_1.css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n width: ", ";\n height: ", ";\n transform: rotate(165deg);\n "], ["\n position: relative;\n width: ", ";\n height: ", ";\n transform: rotate(165deg);\n "])), "" + size + sizeUnit, "" + size + sizeUnit);
  71. };
  72. return _this;
  73. }
  74. Loader.prototype.render = function () {
  75. var _a = this.props, loading = _a.loading, css = _a.css;
  76. return loading ? (core_1.jsx("div", { css: [this.wrapper(), css] },
  77. core_1.jsx("div", { css: this.style(1) }),
  78. core_1.jsx("div", { css: this.style(2) }))) : null;
  79. };
  80. Loader.defaultProps = index_1.sizeDefaults(50);
  81. return Loader;
  82. }(React.PureComponent));
  83. exports.default = Loader;
  84. var templateObject_1, templateObject_2, templateObject_3, templateObject_4;