mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
97 lines
6.7 KiB
JavaScript
97 lines
6.7 KiB
JavaScript
"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 (Object.prototype.hasOwnProperty.call(b, 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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, 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.getSize = function () {
|
|
return _this.props.size || Loader.defaultProps.size;
|
|
};
|
|
_this.ball = function () {
|
|
var _a = helpers_1.parseLengthAndUnit(_this.getSize()), value = _a.value, unit = _a.unit;
|
|
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 * value + unit, "" + -value / 4 + unit);
|
|
};
|
|
_this.ballStyle = function (i) {
|
|
var _a = _this.props, color = _a.color, margin = _a.margin;
|
|
var _b = helpers_1.parseLengthAndUnit(_this.getSize()), value = _b.value, unit = _b.unit;
|
|
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 "])), "" + value / 3 + unit, "" + value / 3 + unit, color, helpers_1.cssValue(margin || Loader.defaultProps.margin), "" + -value / 4 + unit, "" + value + unit, "" + value * 4 + unit, _this.ball(), i * 0.25);
|
|
};
|
|
_this.s1 = function () {
|
|
return helpers_1.cssValue(_this.getSize()) + " solid transparent";
|
|
};
|
|
_this.s2 = function () {
|
|
var color = _this.props.color;
|
|
return helpers_1.cssValue(_this.getSize()) + " solid " + color;
|
|
};
|
|
_this.pacmanStyle = function (i) {
|
|
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, helpers_1.cssValue(_this.getSize()), pacman[i]);
|
|
};
|
|
_this.wrapper = function () {
|
|
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 "])), helpers_1.cssValue(_this.getSize()), helpers_1.cssValue(_this.getSize()));
|
|
};
|
|
_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("span", { css: [this.wrapper(), css] },
|
|
core_1.jsx("span", { css: this.pac() }),
|
|
core_1.jsx("span", { css: this.man() }),
|
|
core_1.jsx("span", { css: this.ballStyle(2) }),
|
|
core_1.jsx("span", { css: this.ballStyle(3) }),
|
|
core_1.jsx("span", { css: this.ballStyle(4) }),
|
|
core_1.jsx("span", { 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;
|