UNPKG

react-loadingg

Version:
101 lines (75 loc) 5.09 kB
"use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireDefault(require("react")); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _style = require("../utils/style"); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _templateObject4() { var data = _taggedTemplateLiteral(["\n height: 2px;\n background: linear-gradient(-45deg, ", ", rgba(0, 0, 255, 0));\n position: absolute;\n border-radius: 50%;\n animation: ", " ", "s ease-in-out infinite, ", " ", "s ease-in-out infinite;\n"]); _templateObject4 = function _templateObject4() { return data; }; return data; } function _templateObject3() { var data = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n position: relative;\n transform: rotateZ(45deg);\n > div:nth-of-type(1) {\n top: 30%;\n left: 25%;\n animation-delay: 0s;\n }\n > div:nth-of-type(2) {\n top: 10%;\n left: 0%;\n animation-delay: 0.8s;\n }\n > div:nth-of-type(3) {\n top: 15%;\n left: 10%;\n animation-delay: 0.5s;\n }\n > div:nth-of-type(4) {\n top: 25%;\n left: 30%;\n animation-delay: 1.6s;\n }\n > div:nth-of-type(5) {\n top: 40%;\n left: 4%;\n animation-delay: 3.2s;\n }\n > div:nth-of-type(6) {\n top: 55%;\n left: 18%;\n animation-delay: 1.2s;\n }\n > div:nth-of-type(7) {\n top: 66%;\n left: 3%;\n animation-delay: 0.4s;\n }\n > div:nth-of-type(8) {\n top: 77%;\n left: 24%;\n animation-delay: 2s;\n }\n > div:nth-of-type(9) {\n top: 83%;\n left: 30%;\n animation-delay: 1s;\n }\n"]); _templateObject3 = function _templateObject3() { return data; }; return data; } function _templateObject2() { var data = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(60px);\n }\n"]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject() { var data = _taggedTemplateLiteral(["\n 0% {\n width: 0;\n }\n 50% {\n width: 40px;\n }\n 100% {\n width: 0;\n }\n"]); _templateObject = function _templateObject() { return data; }; return data; } function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } var scaling = (0, _styledComponents.keyframes)(_templateObject()); var moveTo = (0, _styledComponents.keyframes)(_templateObject2()); var LoadContainer = _styledComponents.default.div(_templateObject3(), function (props) { return props.size === 'small' ? 68 : props.size === 'large' ? 88 : 80; }, function (props) { return props.size === 'small' ? 68 : props.size === 'large' ? 88 : 80; }); var Star = _styledComponents.default.div(_templateObject4(), function (props) { return props.color || '#00adb5'; }, scaling, function (props) { return props.speed || 3; }, moveTo, function (props) { return props.speed || 3; }); var MeteorRainLoading = function MeteorRainLoading(_ref) { var _ref$style = _ref.style, style = _ref$style === void 0 ? _style.commonStyle : _ref$style, color = _ref.color, speed = _ref.speed, _ref$size = _ref.size, size = _ref$size === void 0 ? 'default' : _ref$size; return _react.default.createElement(LoadContainer, { style: style, size: size }, Array.from(Array(9)).map(function (item, index) { return _react.default.createElement(Star, { color: color, speed: speed, key: index }); })); }; var _default = MeteorRainLoading; exports.default = _default;