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ů.

RotateLoader.js 4.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 rotate = core_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {transform: rotate(0deg)}\n 50% {transform: rotate(180deg)}\n 100% {transform: rotate(360deg)}\n"], ["\n 0% {transform: rotate(0deg)}\n 50% {transform: rotate(180deg)}\n 100% {transform: rotate(360deg)}\n"])));
  32. var Loader = /** @class */ (function (_super) {
  33. __extends(Loader, _super);
  34. function Loader() {
  35. var _this = _super !== null && _super.apply(this, arguments) || this;
  36. _this.style = function (i) { return core_1.css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n opacity: 0.8;\n position: absolute;\n top: 0;\n left: ", "px;\n "], ["\n opacity: 0.8;\n position: absolute;\n top: 0;\n left: ", "px;\n "])), i % 2 ? -28 : 25); };
  37. _this.ball = function () {
  38. var _a = _this.props, color = _a.color, size = _a.size, sizeUnit = _a.sizeUnit, margin = _a.margin;
  39. return core_1.css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: 100%;\n "], ["\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: 100%;\n "])), color, "" + size + sizeUnit, "" + size + sizeUnit, margin);
  40. };
  41. _this.wrapper = function () {
  42. return core_1.css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n display: inline-block;\n position: relative;\n animation-fill-mode: both;\n animation: ", " 1s 0s infinite cubic-bezier(0.7, -0.13, 0.22, 0.86);\n "], ["\n ", ";\n display: inline-block;\n position: relative;\n animation-fill-mode: both;\n animation: ", " 1s 0s infinite cubic-bezier(0.7, -0.13, 0.22, 0.86);\n "])), _this.ball(), rotate);
  43. };
  44. _this.long = function () { return core_1.css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n ", ";\n "], ["\n ", ";\n ", ";\n "])), _this.ball(), _this.style(1)); };
  45. _this.short = function () { return core_1.css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n ", ";\n "], ["\n ", ";\n ", ";\n "])), _this.ball(), _this.style(2)); };
  46. return _this;
  47. }
  48. Loader.prototype.render = function () {
  49. var _a = this.props, loading = _a.loading, css = _a.css;
  50. return loading ? (core_1.jsx("div", { css: [this.wrapper(), css] },
  51. core_1.jsx("div", { css: this.long() }),
  52. core_1.jsx("div", { css: this.short() }))) : null;
  53. };
  54. Loader.defaultProps = helpers_1.sizeMarginDefaults(15);
  55. return Loader;
  56. }(React.PureComponent));
  57. exports.default = Loader;
  58. var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;