react-loading-progress
Version:
Loading display components
56 lines (43 loc) • 2.9 kB
JavaScript
var _templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n align-items: center;\n z-index: 2;\n"], ["\n display: flex;\n justify-content: ", ";\n align-items: center;\n z-index: 2;\n"]),
_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n padding-top: 1rem;\n z-index: 2;\n"], ["\n display: flex;\n justify-content: ", ";\n padding-top: 1rem;\n z-index: 2;\n"]),
_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n\n > * {\n width: ", "px;\n height: ", "px;\n min-width: 30x;\n min-height: 30px;\n max-width: 150px;\n max-height: 150px;\n }\n "], ["\n display: flex;\n justify-content: center;\n align-items: center;\n\n > * {\n width: ", "px;\n height: ", "px;\n min-width: 30x;\n min-height: 30px;\n max-width: 150px;\n max-height: 150px;\n }\n "]),
_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n\n > * {\n width: ", "px;\n height: ", "px;\n min-width: 30px;\n min-height: 30px;\n max-width: 150px;\n max-height: 150px;\n }\n "], ["\n display: flex;\n justify-content: center;\n\n > * {\n width: ", "px;\n height: ", "px;\n min-width: 30px;\n min-height: 30px;\n max-width: 150px;\n max-height: 150px;\n }\n "]);
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
import React from "react";
import ReactDOM from "react-dom";
import styled from "styled-components";
var Center = styled.div(_templateObject, function (props) {
return props.placement;
});
var Top = styled.div(_templateObject2, function (props) {
return props.placement;
});
export default (function (_ref) {
var width = _ref.width,
height = _ref.height,
iconSize = _ref.iconSize,
iconHeightSize = _ref.iconHeightSize,
iconWidthSize = _ref.iconWidthSize,
component = _ref.component,
placement = _ref.placement,
center = _ref.center;
if (width === null || height === null) {
return null;
}
var style = {};
var imageStyle = {};
var size = width > height ? height : width;
var CenterIcon = styled.div(_templateObject3, size * iconSize * 0.8 * iconWidthSize, size * iconSize * 0.8 * iconHeightSize);
var TopIcon = styled.div(_templateObject4, size * iconSize * 0.8 * iconWidthSize, size * iconSize * 0.8 * iconHeightSize);
var Load = center ? Center : Top;
var Icon = center ? CenterIcon : TopIcon;
return React.createElement(
Load,
{ style: style, placement: placement },
React.createElement(
Icon,
{ style: imageStyle },
component
)
);
});