12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- "use strict";
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
- return cooked;
- };
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- /** @jsx jsx */
- var React = __importStar(require("react"));
- var core_1 = require("@emotion/core");
- var helpers_1 = require("./helpers");
- 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"])));
- var random = function (top) { return Math.random() * top; };
- var Loader = /** @class */ (function (_super) {
- __extends(Loader, _super);
- function Loader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.style = function (rand) {
- var _a = _this.props, color = _a.color, size = _a.size, sizeUnit = _a.sizeUnit, margin = _a.margin;
- 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);
- };
- _this.wrapper = function () {
- var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit, margin = _a.margin;
- 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);
- };
- return _this;
- }
- Loader.prototype.render = function () {
- var _a = this.props, loading = _a.loading, css = _a.css;
- return loading ? (core_1.jsx("div", { css: [this.wrapper(), css] },
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }),
- core_1.jsx("div", { css: this.style(random(100)) }))) : null;
- };
- Loader.defaultProps = helpers_1.sizeMarginDefaults(15);
- return Loader;
- }(React.PureComponent));
- exports.default = Loader;
- var templateObject_1, templateObject_2, templateObject_3;
|