zent
Version:
一套前端设计语言和基于React的实现
19 lines (18 loc) • 2.22 kB
JavaScript
import { __assign } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import cx from 'classnames';
import getTextPosition from './position';
var DEFAULT_SIZE = 20;
var ColorPresetMap = {
primary: ['#155BD4', '#EDF4FF'],
grey: ['#CCC', '#F7F7F7'],
};
var renderCircleSvg = function (size, colorPreset) {
var colors = ColorPresetMap[colorPreset];
return (_jsx("svg", __assign({ width: size + "px", height: size + "px", viewBox: "0 0 20 20", version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", className: "zent-loading-icon zent-loading-icon-circle", "data-zv": '10.0.17' }, { children: _jsxs("g", __assign({ id: "loading", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", "data-zv": '10.0.17' }, { children: [_jsx("rect", { x: "0", y: "0", width: "20", height: "20", "data-zv": '10.0.17' }, void 0), _jsx("path", { d: "M10,2 C14.418278,2 18,5.581722 18,10 C18,14.418278 14.418278,18 10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 Z M10,4 C6.6862915,4 4,6.6862915 4,10 C4,13.3137085 6.6862915,16 10,16 C13.3137085,16 16,13.3137085 16,10 C16,6.6862915 13.3137085,4 10,4 Z", fill: colors[1], fillRule: "nonzero", "data-zv": '10.0.17' }, void 0), _jsx("path", { d: "M10,2 L10,4 L10,4 C6.6862915,4 4,6.6862915 4,10 C4,13.3137085 6.6862915,16 10,16 L10,18 L10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 Z", fill: colors[0], fillRule: "nonzero", "data-zv": '10.0.17' }, void 0)] }), void 0) }), void 0));
};
export default function CircleIcon(_a) {
var size = _a.size, text = _a.text, textPosition = _a.textPosition, _b = _a.textSize, textSize = _b === void 0 ? 14 : _b, colorPreset = _a.colorPreset;
size = size || DEFAULT_SIZE;
return (_jsxs("div", __assign({ className: cx('zent-loading-icon-and-text', 'zent-loading-icon-and-text--circle', "zent-loading-color-preset--" + colorPreset, getTextPosition(textPosition)), "data-zv": '10.0.17' }, { children: [renderCircleSvg(size, colorPreset), text && (_jsx("div", __assign({ className: "zent-loading-icon-text", style: { fontSize: textSize + "px" }, "data-zv": '10.0.17' }, { children: text }), void 0))] }), void 0));
}