1.1.13 • Published 6 days ago

@sunzi/icon v1.1.13

Weekly downloads
-
License
-
Repository
-
Last release
6 days ago

一个帮助你从 Figma 中拉去 icon 文件本地, 并生成 React 组件的工具


生成图标命令

generate-icon --file=uzP7XhOZK6tN47Mmd3YQbM --folder=src/test --prefixCls=test --gitDiff=false
  Options
    --file, -f    来自 Figma 的文件密钥
    --prefixCls, -c  给 icon 添加前缀 , 最终类名为 <your-prefixCls>-icon
    --folder -fo 存放资源目录
    --gitDiff -d 是否增加git diff输出 (默认true)(在调试阶段可以配置,生产阶段建议不要配置)
    --help        帮助

配置命令

如果你有一个新的图标库需要生成,需要在 packages/icons/package.json 配置一个生成图标命令; 具体更新图标库,就跑对应的命令,例如:pnpm -r --filter=@sunzi/icon run generate-icon:test 生成 test 图标库的命令 生成完成之后,发布

全局样式

图标没有设置任何的样式,需要一个同一的全局配置 样式名称是:prefixCls(变量)+icons 例如 prefixCls=test

.test-icon {
  display: inline-block;
  font-style: normal;
  width: 1em;
  height: 1em;
}

具体样式,项目设置

颜色和大小

颜色:颜色采用的是 fill="currentColor"或者 stroke="currentColor", 只需要改变 css 中的 color 就行了注意, 这样只能适用于统一颜色,无法达到彩色; 大小:svg 没用设置大小,需要全局默认设置 svg 的样式,建议 width:1em;height:1em,采用 em 为单位,这样 svg 的大小就跟 font-szie 的大小一致只需要改变 font-szie,就能改变 svg 的大小

// text-green-7 和 text-24 使用采用tailwind颜色配置
// 相当于
.text-green-7 {
  color: #08D36A;
}
.text-24 {
  font-size: 24px;
}
<IconMore className="text-green-7 text-24" />

其他

填充方式要根据设计提供的 svg 有没有 stroke 或者 fill,改变填充,其他只能自己设置独立的 css 改变; 目前不支持彩色图标,生成的时候,会把fill或者stroke替换成currentColor

1.1.12

6 days ago

1.1.13

6 days ago

1.1.11

16 days ago

1.1.10

17 days ago

1.1.9

25 days ago

1.1.8

1 month ago

1.1.7

2 months ago

1.1.6

3 months ago

1.1.5

4 months ago

1.1.4

4 months ago

1.1.3

4 months ago

1.1.2

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.59

4 months ago

1.0.58

5 months ago

1.0.55

5 months ago

1.0.57

5 months ago

1.0.56

5 months ago

1.0.54

5 months ago

1.0.53

5 months ago

1.0.52

5 months ago

1.0.51

5 months ago

1.0.50

5 months ago

1.0.48

5 months ago

1.0.47

5 months ago

1.0.46

6 months ago

1.0.49

5 months ago

1.0.45

6 months ago

1.0.44

6 months ago

1.0.43

6 months ago

1.0.42

6 months ago

1.0.41

6 months ago

1.0.40

6 months ago

1.0.39

6 months ago

1.0.38

6 months ago

1.0.37

6 months ago

1.0.36

6 months ago

1.0.35

6 months ago

1.0.34

6 months ago

1.0.33

6 months ago

1.0.32

7 months ago

1.0.31

7 months ago

1.0.30

7 months ago

1.0.29

7 months ago

1.0.28

7 months ago

1.0.27

7 months ago

1.0.26

7 months ago

1.0.25

8 months ago

1.0.24

8 months ago

1.0.22

8 months ago

1.0.21

8 months ago

1.0.20

8 months ago

1.0.19

8 months ago

1.0.18

8 months ago

1.0.17

8 months ago

1.0.16

8 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.1.0

9 months ago