UNPKG

@antv/thumbnails-component

Version:

React Component for Thumbnails of Chart Types.

21 lines 870 B
import { __assign, __rest } from "tslib"; import * as React from 'react'; import Thumbnails from '@antv/thumbnails'; export var Thumbnail = function (props) { var _a; var chart = props.chart, svg = props.svg, otherProps = __rest(props, ["chart", "svg"]); // default no-chart-img var src = 'https://gw.alipayobjects.com/zos/antfincdn/lP6YFnCEjy/nochartimg.svg'; // `svg` overwrites `chart` if (svg) { src = "data:image/svg+xml;utf8,".concat(encodeURIComponent(svg)); } else if (chart) { var svgForChart = (_a = Thumbnails[chart]) === null || _a === void 0 ? void 0 : _a.svgCode; if (svgForChart) { src = "data:image/svg+xml;utf8,".concat(encodeURIComponent(svgForChart)); } } return React.createElement("img", __assign({ src: src }, otherProps)); }; //# sourceMappingURL=Thumbnail.js.map