1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- "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 pacman = [
- core_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {transform: rotate(0deg)}\n 50% {transform: rotate(-44deg)}\n "], ["\n 0% {transform: rotate(0deg)}\n 50% {transform: rotate(-44deg)}\n "]))),
- core_1.keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {transform: rotate(0deg)}\n 50% {transform: rotate(44deg)}\n "], ["\n 0% {transform: rotate(0deg)}\n 50% {transform: rotate(44deg)}\n "])))
- ];
- var Loader = /** @class */ (function (_super) {
- __extends(Loader, _super);
- function Loader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.ball = function () {
- var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
- return core_1.keyframes(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n 75% {opacity: 0.7}\n 100% {transform: translate(", ", ", ")}\n "], ["\n 75% {opacity: 0.7}\n 100% {transform: translate(", ", ", ")}\n "])), "" + -4 * size + sizeUnit, "" + -size / 4 + sizeUnit);
- };
- _this.ballStyle = function (i) {
- var _a = _this.props, color = _a.color, margin = _a.margin, size = _a.size, sizeUnit = _a.sizeUnit;
- return core_1.css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n background-color: ", ";\n margin: ", ";\n border-radius: 100%;\n transform: translate(0, ", ");\n position: absolute;\n top: ", ";\n left: ", ";\n animation: ", " 1s ", "s infinite linear;\n animation-fill-mode: both;\n "], ["\n width: ", ";\n height: ", ";\n background-color: ", ";\n margin: ", ";\n border-radius: 100%;\n transform: translate(0, ", ");\n position: absolute;\n top: ", ";\n left: ", ";\n animation: ", " 1s ", "s infinite linear;\n animation-fill-mode: both;\n "])), "" + size / 3 + sizeUnit, "" + size / 3 + sizeUnit, color, margin, "" + -size / 4 + sizeUnit, "" + size + sizeUnit, "" + size * 4 + sizeUnit, _this.ball(), i * 0.25);
- };
- _this.s1 = function () {
- var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
- return "" + size + sizeUnit + " solid transparent";
- };
- _this.s2 = function () {
- var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit, color = _a.color;
- return "" + size + sizeUnit + " solid " + color;
- };
- _this.pacmanStyle = function (i) {
- var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
- var s1 = _this.s1();
- var s2 = _this.s2();
- return core_1.css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 0;\n height: 0;\n border-right: ", ";\n border-top: ", ";\n border-left: ", ";\n border-bottom: ", ";\n border-radius: ", ";\n position: absolute;\n animation: ", " 0.8s infinite ease-in-out;\n animation-fill-mode: both;\n "], ["\n width: 0;\n height: 0;\n border-right: ", ";\n border-top: ", ";\n border-left: ", ";\n border-bottom: ", ";\n border-radius: ", ";\n position: absolute;\n animation: ", " 0.8s infinite ease-in-out;\n animation-fill-mode: both;\n "])), s1, i === 0 ? s1 : s2, s2, i === 0 ? s2 : s1, "" + size + sizeUnit, pacman[i]);
- };
- _this.wrapper = function () {
- var _a = _this.props, size = _a.size, sizeUnit = _a.sizeUnit;
- return core_1.css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: relative;\n font-size: 0;\n height: ", ";\n width: ", ";\n "], ["\n position: relative;\n font-size: 0;\n height: ", ";\n width: ", ";\n "])), "" + size + sizeUnit, "" + size + sizeUnit);
- };
- _this.pac = function () { return _this.pacmanStyle(0); };
- _this.man = function () { return _this.pacmanStyle(1); };
- 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.pac() }),
- core_1.jsx("div", { css: this.man() }),
- core_1.jsx("div", { css: this.ballStyle(2) }),
- core_1.jsx("div", { css: this.ballStyle(3) }),
- core_1.jsx("div", { css: this.ballStyle(4) }),
- core_1.jsx("div", { css: this.ballStyle(5) }))) : null;
- };
- Loader.defaultProps = helpers_1.sizeMarginDefaults(25);
- return Loader;
- }(React.PureComponent));
- exports.default = Loader;
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|