react-loading-progress
Version:
Loading display components
56 lines (45 loc) • 2.55 kB
JavaScript
var _templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n align-items: center;\n position: absolute;\n z-index: 2;\n"], ["\n display: flex;\n justify-content: ", ";\n align-items: center;\n position: absolute;\n z-index: 2;\n"]),
_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n padding-top: 0.5rem;\n position: absolute;\n z-index: 2;\n"], ["\n display: flex;\n justify-content: ", ";\n padding-top: 0.5rem;\n position: absolute;\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: 30px;\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: 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 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 component = _ref.component,
iconSize = _ref.iconSize,
iconHeight = _ref.iconHeight,
iconWidth = _ref.iconWidth,
placement = _ref.placement,
height = _ref.height,
width = _ref.width,
maxHeight = _ref.maxHeight,
maxWidth = _ref.maxWidth,
center = _ref.center;
var style = {
width: (width < 30 ? 0 : width) + "px",
height: (height < 30 ? 0 : height) + "px"
};
var imageStyle = {
width: iconWidth + "px",
height: iconHeight + "px"
};
var CenterIcon = styled.div(_templateObject3, iconWidth * 0.8 * (iconSize || 1.0), iconHeight * 0.8 * (iconSize || 1.0));
var TopIcon = styled.div(_templateObject3, iconWidth * 0.8 * (iconSize || 1.0), iconHeight * 0.8 * (iconSize || 1.0));
var Load = center ? Center : Top;
var Icon = center ? CenterIcon : TopIcon;
return React.createElement(
Load,
{ style: style, placement: placement },
React.createElement(
Icon,
{ style: imageStyle },
component
)
);
});