Skip to content

Commit 774f526

Browse files
authored
fix: svg path 填充的渐变色互相冲突 (#346)
* fix: svg path 填充的渐变色互相冲突 * chore: update config * chore: update icon shanshot
1 parent 5dbecd5 commit 774f526

File tree

7 files changed

+48
-31
lines changed

7 files changed

+48
-31
lines changed

.fatherrc.base.ts

+22-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,26 @@ export default defineConfig({
1010
output: 'dist/esm',
1111
transformer: 'babel',
1212
},
13-
extraBabelPlugins: ['inline-react-svg'],
13+
extraBabelPlugins: [
14+
[
15+
'inline-react-svg',
16+
{
17+
svgo: {
18+
plugins: [
19+
{
20+
name: 'preset-default',
21+
params: {
22+
overrides: {
23+
cleanupIDs: {
24+
// Don't minify ids in `svg` to avoid conflict.
25+
preservePrefixes: ['ant-web3-icon-'],
26+
},
27+
},
28+
},
29+
},
30+
],
31+
},
32+
},
33+
],
34+
],
1435
});

packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap

+8-11
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ exports[`Test Icons > should render all icons 1`] = `
4444
d="M861.977613,265.360106 C865.015764,265.360106 868.053914,265.634346 871,266 C862.99033,259.783882 853.231421,255.396035 842.459796,253.750592 L256.280832,160.783067 C222.124652,155.389671 189.993906,178.425872 184.562061,212.340278 L176,265.451519 L861.977613,265.451519 L861.977613,265.360106 Z"
4545
fill="#CCCCCC"
4646
fill-rule="nonzero"
47-
id="\\u8DEF\\u5F84"
4847
/>
4948
</g>
5049
</svg>
@@ -461,7 +460,7 @@ exports[`Test Icons > should render all icons 13`] = `
461460
>
462461
<defs>
463462
<lineargradient
464-
id="linearGradient-1"
463+
id="ant-web3-icon-polygon-circle-colorful-1"
465464
x1="8.49650828%"
466465
x2="94.4474873%"
467466
y1="76.8030115%"
@@ -503,7 +502,7 @@ exports[`Test Icons > should render all icons 13`] = `
503502
/>
504503
<path
505504
d="M660.07464,622.486301 L804.929811,538.84284 C812.60218,534.410845 817.34776,526.174023 817.34776,517.310032 L817.34776,350.044016 C817.34776,341.200931 812.581275,332.943204 804.929811,328.511208 L660.07464,244.867747 C652.40227,240.435752 642.890205,240.456658 635.217835,244.867747 L490.362664,328.511208 C482.690294,332.943204 477.944714,341.200931 477.944714,350.044016 L477.944714,648.973745 L376.364215,707.614062 L274.783716,648.973745 L274.783716,531.672206 L376.364215,473.031889 L443.366788,511.707321 L443.366788,433.018497 L388.782165,401.513699 C385.01915,399.339512 380.712588,398.189702 376.34331,398.189702 C371.974031,398.189702 367.66747,399.339512 363.92536,401.513699 L219.070189,485.15716 C211.39782,489.589155 206.65224,497.825977 206.65224,506.689968 L206.65224,673.955984 C206.65224,682.799069 211.418725,691.056796 219.070189,695.488792 L363.92536,779.132253 C371.576824,783.543342 381.109795,783.543342 388.782165,779.132253 L533.637336,695.509697 C541.309706,691.077702 546.055286,682.819975 546.055286,673.976889 L546.055286,375.04716 L547.894982,374.001878 L647.635785,316.406843 L749.216284,375.04716 L749.216284,492.3487 L647.635785,550.989016 L580.73774,512.355396 L580.73774,591.04422 L635.217835,622.507207 C642.890205,626.918297 652.40227,626.918297 660.07464,622.507207 L660.07464,622.507207 L660.07464,622.486301 Z"
506-
fill="url(#linearGradient-1)"
505+
fill="url(#ant-web3-icon-polygon-circle-colorful-1)"
507506
/>
508507
</g>
509508
</g>
@@ -1011,7 +1010,7 @@ exports[`Test Icons > should render all icons 23`] = `
10111010
>
10121011
<defs>
10131012
<lineargradient
1014-
id="linearGradient-1"
1013+
id="ant-web3-icon-chrome-circle-colorful-1"
10151014
x1="74.9554145%"
10161015
x2="19.7903626%"
10171016
y1="95.83573%"
@@ -1027,7 +1026,7 @@ exports[`Test Icons > should render all icons 23`] = `
10271026
/>
10281027
</lineargradient>
10291028
<lineargradient
1030-
id="linearGradient-2"
1029+
id="ant-web3-icon-chrome-circle-colorful-2"
10311030
x1="21.2933549%"
10321031
x2="59.7868226%"
10331032
y1="100.176733%"
@@ -1043,7 +1042,7 @@ exports[`Test Icons > should render all icons 23`] = `
10431042
/>
10441043
</lineargradient>
10451044
<lineargradient
1046-
id="linearGradient-3"
1045+
id="ant-web3-icon-chrome-circle-colorful-3"
10471046
x1="1.83307774e-05%"
10481047
x2="100%"
10491048
y1="49.999873%"
@@ -1075,24 +1074,22 @@ exports[`Test Icons > should render all icons 23`] = `
10751074
<path
10761075
d="M512.007311,767.989827 C653.398962,767.989827 768.019094,653.36824 768.019094,511.974795 C768.019094,370.581351 653.398962,255.959764 512.007311,255.959764 C370.615661,255.959764 255.995528,370.581351 255.995528,511.974795 C255.995528,653.36824 370.615661,767.989827 512.007311,767.989827 Z"
10771076
fill="#FFFFFF"
1078-
id="\\u8DEF\\u5F84"
10791077
/>
10801078
<path
10811079
d="M290.294605,640.039203 L68.6173343,256.078425 C23.6686547,333.906995 0,422.198858 0,512.075576 C0,601.952294 23.6564637,690.245783 68.5996167,768.077603 C113.542932,845.909424 178.185826,910.53737 256.028037,955.462725 C333.870249,1000.38646 422.167494,1024.02436 512.043071,1024 L733.720017,640.039203 L733.720017,639.972558 C711.267377,678.9096 678.957878,711.247143 640.040836,733.732577 C601.123794,756.218012 556.972733,768.059723 512.026817,768.066225 C467.0809,768.072727 422.924963,756.245645 384.00142,733.769963 C345.079501,711.295907 312.758623,678.968117 290.294605,640.039203 Z"
1082-
fill="url(#linearGradient-1)"
1080+
fill="url(#ant-web3-icon-chrome-circle-colorful-1)"
10831081
/>
10841082
<path
10851083
d="M733.703762,640.022948 L512.028442,1023.98373 C601.90402,1023.99673 690.198014,1000.34582 768.033723,955.409084 C845.869433,910.473976 910.503062,845.837902 955.435974,767.999579 C1000.36726,690.159632 1024.01462,601.862892 1024,511.986174 C1023.98374,422.109456 1000.30549,333.822469 955.344948,255.998776 L511.991056,255.998776 L511.93579,256.032911 C556.881707,256.010155 601.040895,267.824232 639.972566,290.283659 C678.904237,312.744711 711.234868,345.059497 733.713515,383.981909 C756.192162,422.902696 768.025596,467.057568 768.025596,512.002429 C768.023971,556.948915 756.187286,601.102162 733.707013,640.022948 L733.703762,640.022948 Z"
1086-
fill="url(#linearGradient-2)"
1084+
fill="url(#ant-web3-icon-chrome-circle-colorful-2)"
10871085
/>
10881086
<path
10891087
d="M512.007311,714.709441 C623.942165,714.709441 714.684119,623.966336 714.684119,512.030062 C714.684119,400.093789 623.942165,309.350683 512.007311,309.350683 C400.072458,309.350683 309.332129,400.093789 309.332129,512.030062 C309.332129,623.966336 400.072458,714.709441 512.007311,714.709441 Z"
10901088
fill="#1A73E8"
1091-
id="\\u8DEF\\u5F84"
10921089
/>
10931090
<path
10941091
d="M512.008937,256.015031 L955.362828,256.015031 C910.434792,178.173458 845.806039,113.532019 767.973581,68.5910595 C690.141122,23.6502622 601.847129,0 511.971551,0 C422.095973,0 333.806855,23.6754573 255.980899,68.6274705 C178.153317,113.579321 113.534155,178.23035 68.6183096,256.0768 L290.294605,640.037578 L290.351497,640.068462 C267.859846,601.154177 256.010157,557.005808 255.995528,512.059321 C255.980899,467.112835 267.802954,422.954712 290.270223,384.027423 C312.735866,345.100134 345.05837,312.77397 383.981914,290.303165 C422.907083,267.830734 467.06302,256.005278 512.008937,256.015031 Z"
1095-
fill="url(#linearGradient-3)"
1092+
fill="url(#ant-web3-icon-chrome-circle-colorful-3)"
10961093
/>
10971094
</g>
10981095
</g>

packages/icons/src/__tests__/iconTest.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export async function getComponents(dir: string): Promise<ComponentType[]> {
1111
const displayNames = Object.keys(comp);
1212
displayNames.forEach((displayName) => {
1313
const Icon = comp[displayName];
14-
console.log('get Icon', Icon);
1514
res.push(Icon);
1615
});
1716
}
Loading

packages/icons/src/svgs/polygon-circle-colorful.svg

+3-3
Loading

packages/icons/src/svgs/wallet-white-colorful.svg

+2-2
Loading

0 commit comments

Comments
 (0)