Quellcode durchsuchen

Update documents

dufu1991 vor 3 Jahren
Ursprung
Commit
8f46654b7d
2 geänderte Dateien mit 31 neuen und 11 gelöschten Zeilen
  1. 13 3
      doc/guide/icon.md
  2. 18 8
      doc/guide/icon_en.md

+ 13 - 3
doc/guide/icon.md

@@ -4,9 +4,17 @@ STDF 使用 SVG Sprites 技术使用图标,这样可以减少 HTTP 请求,
 
 STDF 的 SVG Sprites 是使用 [SVG symbol](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol),大致原理类似于 CSS 中的 Sprite 技术,将项目中的 SVG 拼接在一个文件内,通过 SVG 中的 use 元素找到对应的图标来显示。
 
+你可以把它类比看成是一种字体,只不过这种字体是由 SVG 组成的,而且可以通过 CSS 控制颜色、大小等属性。所以如果用到比较大或者有多种颜色等比较复杂的图标,建议单独引入 SVG 文件使用,不要放在 symbol 中。
+
 兼容性方面也完全没问题。参考 [MDN symbol](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol#browser_compatibility)。
 
-## 内置
+## rollup-plugin-stdf-icon
+
+STDF 已经开发了一个 Rollup/Vite 插件,用于将项目中的 SVG 文件合并成 SVG Sprites,具体使用请参考 [rollup-plugin-stdf-icon](https://www.npmjs.com/package/rollup-plugin-stdf-icon),由于 svg 格式的多样性,可能存在 rollup-plugin-stdf-icon 处理不准确的情况,请到 [GitHub](https://github.com/dufu1991/stdf/issues) 提 issue,注明 svg 文件的具体情况。
+
+或使用其他 SVG Sprites 合成工具或手动合成,也可以请设计师提供设计物料时一并提供对应的 SVG Sprites。或类似 Remix Icon 这样的图标库,可以直接将选定的多个图标下载为 SVG Sprites。
+
+## 内置说明
 
 STDF 部分组件内使用的图标源自 [Remix Icon 图标库](https://remixicon.com)([GitHub](https://github.com/Remix-Design/remixicon)),在此表示感谢 🙏🏻🙏🏻。
 
@@ -14,7 +22,7 @@ STDF 部分组件内使用的图标源自 [Remix Icon 图标库](https://remixic
 
 具体使用如下:
 
-| 名称                          | 所属组件         |
+| 图标名称                      | 所属组件         |
 | ----------------------------- | ---------------- |
 | ri-user-3-line                | Avatar           |
 | ri-arrow-right-s-line         | Cell / NoticeBar |
@@ -39,4 +47,6 @@ STDF 部分组件内使用的图标源自 [Remix Icon 图标库](https://remixic
 | ri-error-warning-line         | Toast            |
 | ri-information-line           | Toast            |
 
-目前前端打包工具无论是 Webpack 还是 Vite 或者 Rollup 都有对应的 SVG Sprites 合成插件,请自行选择或手动合成。
+可到 `node_modules/stdf/dist/assets/fonts/stdf.remixicon.symbol.svg` 查看由这些图标组成的 SVG Sprites。
+
+可到 `node_modules/stdf/dist/assets/svg_base/` 查看这些图标的 SVG 源文件。

+ 18 - 8
doc/guide/icon_en.md

@@ -1,18 +1,26 @@
 ## Background
 
-STDF uses SVG Sprites technology to display icons, which reduces HTTP requests and improves page performance.
+STDF uses SVG Sprites technology for icons, which helps reduce HTTP requests and improve page performance.
 
-STDF's SVG Sprites uses [SVG symbol](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol), which is similar to CSS Sprite technology. STDF combines SVG files into one file and uses the `use` element in SVG to display the corresponding icon.
+STDF's SVG Sprites use [SVG symbol](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol), which is similar to CSS Sprite technique. It combines SVG files in the project into a single file and uses the `<use>` element in SVG to display the corresponding icons.
 
-Compatibility is not an issue either. Please refer to [MDN symbol](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol#browser_compatibility).
+You can think of it as a type of font, except that it is composed of SVG and can be styled using CSS properties such as color and size. Therefore, for larger or more complex icons with multiple colors, it is recommended to use individual SVG files instead of placing them in the symbol.
 
-## Built-in
+Compatibility is not an issue. Refer to [MDN symbol](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol#browser_compatibility) for more information.
 
-Some icons used within STDF components are sourced from [Remix Icon Library](https://remixicon.com) ([GitHub](https://github.com/Remix-Design/remixicon)). Thanks to them 🙏🏻🙏🏻.
+## rollup-plugin-stdf-icon
 
-**If you use these components, please ensure that your `symbol.svg` file contains the corresponding icon.**
+STDF has developed a Rollup/Vite plugin called rollup-plugin-stdf-icon, which combines SVG files in the project into SVG Sprites. Please refer to [rollup-plugin-stdf-icon](https://www.npmjs.com/package/rollup-plugin-stdf-icon) for specific usage. Due to the diversity of SVG formats, there may be cases where rollup-plugin-stdf-icon does not handle them accurately. In such cases, please raise an issue on [GitHub](https://github.com/dufu1991/stdf/issues) and provide details about the SVG file.
 
-You can use them as follows:
+Alternatively, you can use other SVG Sprites synthesis tools or manually combine them. You can also ask the designer to provide the corresponding SVG Sprites along with the design materials.Or, for icon libraries like Remix Icon, you can directly download a selection of multiple icons as SVG Sprites.
+
+## Built-in Icons
+
+Some of the icons used in STDF components are sourced from [Remix Icon Library](https://remixicon.com) ([GitHub](https://github.com/Remix-Design/remixicon)). Many thanks to them! 🙏🏻🙏🏻
+
+**If you are using these components, please make sure that the `symbol.svg` file in your project includes the corresponding icons.**
+
+Here are the icons and their corresponding components:
 
 | Icon Name                     | Component        |
 | ----------------------------- | ---------------- |
@@ -39,4 +47,6 @@ You can use them as follows:
 | ri-error-warning-line         | Toast            |
 | ri-information-line           | Toast            |
 
-Currently, most front-end build tools, such as Webpack, Vite, or Rollup, have corresponding SVG Sprite plugins. Please choose one or manually combine them.
+You can find the SVG Sprites composed of these icons in `node_modules/stdf/dist/assets/fonts/stdf.remixicon.symbol.svg`.
+
+You can find the SVG source files for these icons in `node_modules/stdf/dist/assets/svg_base/`.