Skip to content

Commit fbabea9

Browse files
authored
docs: name casing in doc (vueComponent#4944)
* doc: convert the name of icon components to kebab-case * doc: copy kebab cased icon name
1 parent 4a80b55 commit fbabea9

File tree

6 files changed

+37
-26
lines changed

6 files changed

+37
-26
lines changed

components/icon/demo/basic.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Import icons from `@ant-design/icons-vue`, component name of icons with differen
1818

1919
<template>
2020
<div class="icons-list">
21-
<HomeOutlined />
22-
<SettingFilled />
23-
<SmileOutlined />
24-
<SyncOutlined spin />
25-
<SmileOutlined :rotate="180" />
26-
<LoadingOutlined />
21+
<home-outlined />
22+
<setting-filled />
23+
<smile-outlined />
24+
<sync-outlined spin />
25+
<smile-outlined :rotate="180" />
26+
<loading-outlined />
2727
</div>
2828
</template>
2929
<script lang="ts">

components/icon/demo/custom.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ Create a reusable Vue component by using `Icon`. The property / slot `component`
1818

1919
<template>
2020
<div class="custom-icons-list">
21-
<Icon :style="{ color: 'hotpink' }">
21+
<icon :style="{ color: 'hotpink' }">
2222
<template #component>
2323
<svg width="1em" height="1em" fill="currentColor" viewBox="0 0 1024 1024">
2424
<path
2525
d="M923 283.6c-13.4-31.1-32.6-58.9-56.9-82.8-24.3-23.8-52.5-42.4-84-55.5-32.5-13.5-66.9-20.3-102.4-20.3-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5-24.4 23.9-43.5 51.7-56.9 82.8-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3 0.1-35.3-7-69.6-20.9-101.9z"
2626
/>
2727
</svg>
2828
</template>
29-
</Icon>
29+
</icon>
3030

31-
<Icon :style="{ fontSize: '32px' }">
31+
<icon :style="{ fontSize: '32px' }">
3232
<template #component="svgProps">
3333
<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" v-bind="svgProps">
3434
<path
@@ -73,7 +73,7 @@ Create a reusable Vue component by using `Icon`. The property / slot `component`
7373
/>
7474
</svg>
7575
</template>
76-
</Icon>
76+
</icon>
7777
</div>
7878
</template>
7979
<script lang="ts">

components/icon/demo/two-tone.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ title:
88

99
## zh-CN
1010

11-
双色图标可以通过 `twoToneColor` 属性设置主题色。
11+
双色图标可以通过 `two-tone-color` 属性设置主题色。
1212

1313
## en-US
1414

15-
You can set `twoToneColor` prop to specific primary color for two-tone icons.
15+
You can set `two-tone-color` prop to specific primary color for two-tone icons.
1616

1717
</docs>
1818

1919
<template>
2020
<div class="icons-list">
21-
<SmileTwoTone />
22-
<HeartTwoTone two-tone-color="#eb2f96" />
23-
<CheckCircleTwoTone two-tone-color="#52c41a" />
21+
<smile-two-tone />
22+
<heart-two-tone two-tone-color="#eb2f96" />
23+
<check-circle-two-tone two-tone-color="#52c41a" />
2424
</div>
2525
</template>
2626
<script>

components/icon/index.en-US.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ We still have three different themes for icons, icon component name is the icon
2727
```jsx
2828
import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
2929

30-
<StarOutlined />
31-
<StarFilled />
32-
<StarTwoTone twoToneColor="#eb2f96" />
30+
<star-outlined />
31+
<star-filled />
32+
<star-two-tone two-tone-color="#eb2f96" />
3333
```
3434

3535
### Custom Icon
@@ -60,7 +60,7 @@ The properties `theme`, `component` and `twoToneColor` were added in `1.2.0`. Th
6060

6161
```html
6262
<template>
63-
<MessageOutlined :style="{fontSize: '16px', color: '#08c'}" />
63+
<message-outlined :style="{fontSize: '16px', color: '#08c'}" />
6464
</template>
6565
<script>
6666
import { MessageOutlined } from '@ant-design/icons-vue';

components/icon/index.zh-CN.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ npm install --save @ant-design/icons-vue
1616

1717
安装 [Kitchen Sketch 插件 💎](https://kitchen.alipay.com),就可以一键拖拽使用 Ant Design 和 Iconfont 的海量图标,还可以关联自有项目。
1818

19-
2019
## API
2120

2221
### 通用图标
@@ -33,9 +32,9 @@ npm install --save @ant-design/icons-vue
3332
```jsx
3433
import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
3534

36-
<StarOutlined />
37-
<StarFilled />
38-
<StarTwoTone twoToneColor="#eb2f96" />
35+
<star-outlined />
36+
<star-filled />
37+
<star-two-tone two-tone-color="#eb2f96" />
3938
```
4039

4140
### 自定义 Icon/Custom Icon
@@ -62,7 +61,7 @@ import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
6261

6362
```html
6463
<template>
65-
<MessageOutlined :style="{fontSize: '16px', color: '#08c'}" />
64+
<message-outlined :style="{fontSize: '16px', color: '#08c'}" />
6665
</template>
6766
<script>
6867
import { MessageOutlined } from '@ant-design/icons-vue';

site/src/theme/template/IconDisplay/CopyableIcon.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<component :is="allIcons[name]"></component>
88
<span class="anticon-class">
99
<a-badge :dot="isNew">
10-
{{ type }}
10+
{{ kebabCasedType }}
1111
</a-badge>
1212
</span>
1313
</li>
@@ -19,15 +19,27 @@ import { defineComponent } from 'vue';
1919
2020
const allIcons = AntdIcons;
2121
22+
const kebabCase = function kebabCase(str) {
23+
return str
24+
.split(/(?=[A-Z])/)
25+
.join('-')
26+
.toLowerCase();
27+
};
28+
2229
export default defineComponent({
2330
components: {
2431
'a-badge': Badge,
2532
},
2633
props: ['name', 'type', 'isNew', 'theme', 'justCopied'],
2734
data() {
35+
const kebabCasedName = kebabCase(this.name);
36+
const kebabCasedType = kebabCase(this.type);
37+
2838
this.allIcons = allIcons;
39+
2940
return {
30-
text: `<${this.name} />`,
41+
text: `<${kebabCasedName} />`,
42+
kebabCasedType,
3143
};
3244
},
3345
methods: {

0 commit comments

Comments
 (0)