react-loadingg
Version:
A React component library.
156 lines (117 loc) • 6.35 kB
JavaScript
;
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 _templateObject7() {
var data = _taggedTemplateLiteral(["\n position: relative;\n animation: ", " ", "s infinite linear;\n"]);
_templateObject7 = function _templateObject7() {
return data;
};
return data;
}
function _templateObject6() {
var data = _taggedTemplateLiteral(["\n width: 4px;\n height: 4px;\n border: 3px ", " solid;\n background: #fff;\n border-radius: 5px;\n transform: translateX(-3px) translateY(-4px);\n position:absolute;\n"]);
_templateObject6 = function _templateObject6() {
return data;
};
return data;
}
function _templateObject5() {
var data = _taggedTemplateLiteral(["\n height: 0;\n width: 2px;\n border-width: ", "px 2px 0px 2px;\n border-style: solid solid none;\n border-color: ", " transparent transparent;\n transform-origin: 5px 0;\n transform: rotate(300deg);\n position: absolute;\n"]);
_templateObject5 = function _templateObject5() {
return data;
};
return data;
}
function _templateObject4() {
var data = _taggedTemplateLiteral(["\n height: 0;\n width: 2px;\n border-width: ", "px 2px 0px 2px;\n border-style: solid solid none;\n border-color: ", " transparent transparent;\n transform-origin: 2px -1px;\n transform: rotate(180deg);\n position: absolute;\n"]);
_templateObject4 = function _templateObject4() {
return data;
};
return data;
}
function _templateObject3() {
var data = _taggedTemplateLiteral(["\n height: 0;\n width: 2px;\n border-width: ", "px 2px 0px 2px;\n border-style: solid solid none;\n border-color: ", " transparent transparent;\n transform-origin: 0 -2px;\n transform: rotate(60deg);\n position: absolute;\n"]);
_templateObject3 = function _templateObject3() {
return data;
};
return data;
}
function _templateObject2() {
var data = _taggedTemplateLiteral(["\n height: 0;\n width: 4px;\n border-width: 0 4px ", "px 4px;\n border-style: none solid solid;\n border-color: transparent transparent ", ";\n position: relative;\n padding-top: 25px;\n"]);
_templateObject2 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject() {
var data = _taggedTemplateLiteral(["\n 0% {\n transform: rotate(360deg);\n }\n 50% {\n transform: rotate(180deg);\n }\n 100% {\n transform: rotate(0deg);\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 bouncedelay = (0, _styledComponents.keyframes)(_templateObject());
var LoadingContainer = _styledComponents.default.div(_templateObject2(), function (props) {
return props.size === 'small' ? 40 : props.size === 'large' ? 60 : 50;
}, function (props) {
return props.color || '#00adb5';
});
var ItemFirst = _styledComponents.default.div(_templateObject3(), function (props) {
return props.size === 'small' ? 24 : props.size === 'large' ? 40 : 30;
}, function (props) {
return props.color || '#00adb5';
});
var ItemSecord = _styledComponents.default.div(_templateObject4(), function (props) {
return props.size === 'small' ? 24 : props.size === 'large' ? 40 : 30;
}, function (props) {
return props.color || '#00adb5';
});
var ItemThree = _styledComponents.default.div(_templateObject5(), function (props) {
return props.size === 'small' ? 24 : props.size === 'large' ? 40 : 30;
}, function (props) {
return props.color || '#00adb5';
});
var Center = _styledComponents.default.div(_templateObject6(), function (props) {
return props.color || '#00adb5';
});
var Con = _styledComponents.default.div(_templateObject7(), bouncedelay, function (props) {
return props.speed || 5;
});
var WindMillLoading = function WindMillLoading(_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(LoadingContainer, {
style: style,
color: color,
size: size
}, _react.default.createElement(Center, {
color: color
}), _react.default.createElement(Con, {
speed: speed
}, _react.default.createElement(ItemFirst, {
color: color,
size: size
}), _react.default.createElement(ItemSecord, {
color: color,
size: size
}), _react.default.createElement(ItemThree, {
color: color,
size: size
})));
};
var _default = WindMillLoading;
exports.default = _default;