Skip to content

Commit a599674

Browse files
committed
【feature】1) 文档使用的符号图片修改,因为图片名称重命名
(reviewed by yangtt)
1 parent ea26335 commit a599674

File tree

1 file changed

+17
-4
lines changed
  • examples/mapboxgl-v2/docs/modules/icon-card

1 file changed

+17
-4
lines changed

examples/mapboxgl-v2/docs/modules/icon-card/index.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ const IconCard = (props: IconCardContentProps) => {
1313
const modal = useRef<any>(null);
1414
const title = iconInfo.name;
1515
const id = iconInfo.id;
16-
const isPolygon = type === 'polygon';
17-
// eslint-disable-next-line import/no-dynamic-require
18-
const { color, image } = isPolygon && require(`../../../static/symbols/polygon/polygon-${id}.json`);
19-
const imgUrl = isPolygon ? image : `../../static/images/${type}/${id}.png`;
16+
17+
const getImageUrl = (id) => {
18+
const isPolygon = type === 'polygon';
19+
if(isPolygon) {
20+
const { paint = {} } = isPolygon && require(`../../../static/symbols/polygon/${type}-${id}.json`),
21+
{'fill-color': color, 'fill-pattern': imgId} = paint;
22+
return {
23+
color,
24+
imageUrl: imgId ? `../../../static/images/${type}/${imgId}.png`: undefined
25+
}
26+
}
27+
return {
28+
imageUrl: `../../../static/images/${type}/${type}-${id}.png`
29+
};
30+
}
31+
32+
const {imageUrl: imgUrl, color} = getImageUrl(id);
2033
return (
2134
<>
2235
<div className="icon-image" onClick={() => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy