From 794240344bfe1505ef645f0dce50163ca6b9ea60 Mon Sep 17 00:00:00 2001 From: "tingzhao.ytz" Date: Thu, 21 Mar 2024 11:37:52 +0800 Subject: [PATCH] fix: icon svg style bug --- .changeset/hot-cheetahs-cheat.md | 5 + docs/guide/contribute-icons.md | 7 + docs/guide/contribute-icons.zh-CN.md | 7 + .../__snapshots__/index.test.tsx.snap | 1434 +++++++++-------- .../src/components/safeheron-colorful.tsx | 1 + .../icons/src/svgs/aave-circle-colorful.svg | 11 +- packages/icons/src/svgs/akro-colorful.svg | 8 +- .../icons/src/svgs/alpha-circle-colorful.svg | 18 +- packages/icons/src/svgs/any-colorful.svg | 8 +- .../icons/src/svgs/ape-circle-colorful.svg | 110 +- packages/icons/src/svgs/api3-colorful.svg | 338 ++-- .../icons/src/svgs/arrr-circle-colorful.svg | 8 +- .../icons/src/svgs/astr-circle-colorful.svg | 92 +- .../icons/src/svgs/bsw-circle-colorful.svg | 16 +- packages/icons/src/svgs/bzrx-colorful.svg | 12 +- .../icons/src/svgs/cdai-circle-colorful.svg | 18 +- .../icons/src/svgs/cow-circle-colorful.svg | 22 +- packages/icons/src/svgs/deso-colorful.svg | 20 +- .../icons/src/svgs/divi-circle-colorful.svg | 8 +- packages/icons/src/svgs/dmt-colorful.svg | 2 +- .../icons/src/svgs/drt-circle-colorful.svg | 8 +- packages/icons/src/svgs/dydx-colorful.svg | 18 +- .../icons/src/svgs/eurs-circle-colorful.svg | 17 +- .../icons/src/svgs/gxc-circle-colorful.svg | 2 +- packages/icons/src/svgs/hedg-colorful.svg | 2 +- packages/icons/src/svgs/hex-colorful.svg | 2 +- packages/icons/src/svgs/inj-colorful.svg | 14 +- packages/icons/src/svgs/iqn-colorful.svg | 2 +- .../icons/src/svgs/iris-circle-colorful.svg | 58 +- packages/icons/src/svgs/karma-colorful.svg | 2 +- .../icons/src/svgs/kmd-circle-colorful.svg | 2 +- packages/icons/src/svgs/lbc-colorful.svg | 2 +- .../icons/src/svgs/ldo-circle-colorful.svg | 38 +- packages/icons/src/svgs/leo-colorful.svg | 342 ++-- packages/icons/src/svgs/lto-colorful.svg | 2 +- packages/icons/src/svgs/matic-colorful.svg | 5 +- .../icons/src/svgs/meld-circle-colorful.svg | 14 +- .../icons/src/svgs/mkr-circle-colorful.svg | 2 +- .../icons/src/svgs/mph-circle-colorful.svg | 12 +- packages/icons/src/svgs/mtl-colorful.svg | 82 +- .../icons/src/svgs/mxc-circle-colorful.svg | 12 +- packages/icons/src/svgs/myst-colorful.svg | 2 +- packages/icons/src/svgs/nim-colorful.svg | 36 +- packages/icons/src/svgs/one-colorful.svg | 2 +- packages/icons/src/svgs/rev-colorful.svg | 2 +- packages/icons/src/svgs/rune-colorful.svg | 8 +- .../src/svgs/safemoon-circle-colorful.svg | 34 +- .../icons/src/svgs/sand-circle-colorful.svg | 10 +- packages/icons/src/svgs/sha-colorful.svg | 62 +- .../icons/src/svgs/snow-circle-colorful.svg | 16 +- packages/icons/src/svgs/srm-colorful.svg | 20 +- .../icons/src/svgs/tfuel-circle-colorful.svg | 18 +- .../icons/src/svgs/trb-circle-colorful.svg | 2 +- .../icons/src/svgs/twokey-circle-colorful.svg | 14 +- packages/icons/src/svgs/veil-colorful.svg | 48 +- packages/icons/src/svgs/xaut-colorful.svg | 2 +- .../icons/src/svgs/xec-circle-colorful.svg | 2 +- packages/icons/src/svgs/xpr-colorful.svg | 8 +- .../icons/src/svgs/yfi-circle-colorful.svg | 14 +- .../__snapshots__/index.test.tsx.snap | 44 + 60 files changed, 1705 insertions(+), 1422 deletions(-) create mode 100644 .changeset/hot-cheetahs-cheat.md diff --git a/.changeset/hot-cheetahs-cheat.md b/.changeset/hot-cheetahs-cheat.md new file mode 100644 index 000000000..7718773f6 --- /dev/null +++ b/.changeset/hot-cheetahs-cheat.md @@ -0,0 +1,5 @@ +--- +'@ant-design/web3-icons': patch +--- + +fix: icon svg style error diff --git a/docs/guide/contribute-icons.md b/docs/guide/contribute-icons.md index d96a628eb..6d2672ee7 100644 --- a/docs/guide/contribute-icons.md +++ b/docs/guide/contribute-icons.md @@ -40,6 +40,13 @@ The `packages/icons` directory corresponds to the `@ant-design/web3-icons` packa Add new svg in `svgs` folder, file name should be the same as icon name, and use the [kebab-case](https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case) style for file name. +Also, please note that do not use `id` in the `style` attribute of the svg, because the `react-inline-svg-unique-id` plugin does not support `style`. We recommend that the properties in `style` be taken out as separate attributes as much as possible: + +```diff +- # bad ++ # good +``` + ## Complete the icon react component In the `components` directory, refer to the following template to complete the component. There are two parts that need to be changed: diff --git a/docs/guide/contribute-icons.zh-CN.md b/docs/guide/contribute-icons.zh-CN.md index 59aad0e5f..5eb2e907b 100644 --- a/docs/guide/contribute-icons.zh-CN.md +++ b/docs/guide/contribute-icons.zh-CN.md @@ -40,6 +40,13 @@ group: 在 `svgs` 目录下添加新的 svg 文件,文件名应该和图标名称一致,注意文件名应该使用 [kebab-case](https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case) 风格。 +另外需要注意的是,在 svg 的 `style` 属性中请勿使用 `id`,因为 `react-inline-svg-unique-id` 插件不支持识别 `style`,我们建议 `style` 中的属性尽量拿出来单独作为属性: + +```diff +- # bad ++ # good +``` + ## 完成图标 react 组件 在 `components` 目录下参考如下模板完成组件,有两部分需要更改: diff --git a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap index 6fa9a1c32..792d1693d 100644 --- a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap @@ -895,6 +895,7 @@ exports[`Test Icons > should render all icons 7`] = ` @@ -1338,6 +1347,7 @@ exports[`Test Icons > should render all icons 16`] = ` @@ -2089,15 +2100,15 @@ exports[`Test Icons > should render all icons 29`] = ` @@ -2425,7 +2436,8 @@ exports[`Test Icons > should render all icons 37`] = ` > should render all icons 66`] = ` @@ -21472,6 +21506,7 @@ exports[`Test Icons > should render all icons 349`] = ` @@ -22469,7 +22504,7 @@ exports[`Test Icons > should render all icons 370`] = ` > @@ -29026,8 +29061,8 @@ exports[`Test Icons > should render all icons 372`] = ` hedgetrade-hedg-logo @@ -29231,12 +29266,12 @@ exports[`Test Icons > should render all icons 377`] = ` @@ -31116,6 +31151,7 @@ exports[`Test Icons > should render all icons 418`] = ` @@ -33377,6 +33415,7 @@ exports[`Test Icons > should render all icons 444`] = ` +
+
+ Test_0x21CDf0974d53a6e96eF05d7B324a9803735fFd3B_123 +
+
+ + + + Preview +
+
+
+
+ +`; + +exports[`NFTImage > use custom getNFTMetadata 2`] = `