UNPKG

react-loadingg

Version:
151 lines (112 loc) 5.4 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 _templateObject8() { var data = _taggedTemplateLiteral(["\n animation-delay: -0.8s;\n"]); _templateObject8 = function _templateObject8() { return data; }; return data; } function _templateObject7() { var data = _taggedTemplateLiteral(["\n animation-delay: -0.9s;\n"]); _templateObject7 = function _templateObject7() { return data; }; return data; } function _templateObject6() { var data = _taggedTemplateLiteral(["\n animation-delay: -1s;\n"]); _templateObject6 = function _templateObject6() { return data; }; return data; } function _templateObject5() { var data = _taggedTemplateLiteral(["\n animation-delay: -1.1s;\n"]); _templateObject5 = function _templateObject5() { return data; }; return data; } function _templateObject4() { var data = _taggedTemplateLiteral(["\n animation-delay: -1.2s;\n"]); _templateObject4 = function _templateObject4() { return data; }; return data; } function _templateObject3() { var data = _taggedTemplateLiteral(["\n background-color: ", ";\n height: 100%;\n width: 6px;\n display: inline-block;\n margin-left: 5px;\n animation: ", " ", "s infinite ease-in-out;\n"]); _templateObject3 = function _templateObject3() { return data; }; return data; } function _templateObject2() { var data = _taggedTemplateLiteral(["\n width: 100px;\n height: ", ";\n text-align: center;\n font-size: 10px;\n"]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject() { var data = _taggedTemplateLiteral(["\n 0%,\n 40%,\n 100% {\n -webkit-transform: scaleY(0.4);\n }\n 20% {\n -webkit-transform: scaleY(1);\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 stretchdelay = (0, _styledComponents.keyframes)(_templateObject()); var LoadContainer = _styledComponents.default.div(_templateObject2(), function (props) { return _style.sizeContainer[props.size] || _style.sizeContainer['default']; }); var box = _styledComponents.default.div(_templateObject3(), function (props) { return props.color || '#00adb5'; }, stretchdelay, function (props) { return props.speed || 1.2; }); var BoxLoadingFirst = (0, _styledComponents.default)(box)(_templateObject4()); var BoxLoadingTwo = (0, _styledComponents.default)(box)(_templateObject5()); var BoxLoadingThree = (0, _styledComponents.default)(box)(_templateObject6()); var BoxLoadingFour = (0, _styledComponents.default)(box)(_templateObject7()); var BoxLoadingFive = (0, _styledComponents.default)(box)(_templateObject8()); var WaveLoading = function WaveLoading(_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 }, _react.default.createElement(BoxLoadingFirst, { color: color, speed: speed }), _react.default.createElement(BoxLoadingTwo, { color: color, speed: speed }), _react.default.createElement(BoxLoadingThree, { color: color, speed: speed }), _react.default.createElement(BoxLoadingFour, { color: color, speed: speed }), _react.default.createElement(BoxLoadingFive, { color: color, speed: speed })); }; var _default = WaveLoading; exports.default = _default;