docs: Translation tag (#2795)

This commit is contained in:
Shawn Sit 2016-08-22 20:37:10 -05:00 committed by Benjy Cui
parent 5dcce12c2c
commit b85d158fd0
5 changed files with 63 additions and 16 deletions

View File

@ -1,10 +1,18 @@
---
order: 0
title: 基本
title:
zh-CN: 基本
en-US: Basic
---
## zh-CN
简单的标签展示,添加 closable 表示可关闭。
## en-US
Simple demo of tag, 'closable' property represents which can be closed.
````jsx
import { Tag } from 'antd';
@ -13,8 +21,8 @@ function onClose(e) {
}
ReactDOM.render(<div>
<Tag>标签一</Tag>
<Tag>标签二</Tag>
<Tag closable onClose={onClose}>标签三</Tag>
<Tag>Tag 1</Tag>
<Tag>Tag 2</Tag>
<Tag closable onClose={onClose}>Tag 3</Tag>
</div>, mountNode);
````

View File

@ -1,17 +1,24 @@
---
order: 1
title: 各种类型
title:
zh-CN: 各种类型
en-US: Colorful tags
---
## zh-CN
四种颜色的标签。
## en-US
Colorful tags.
````jsx
import { Tag } from 'antd';
ReactDOM.render(<div>
<Tag closable color="blue">蓝色</Tag>
<Tag closable color="green">绿色</Tag>
<Tag closable color="yellow"><a href="https://github.com/ant-design/ant-design/issues/1862">黄色</a></Tag>
<Tag closable color="red">红色</Tag>
<Tag closable color="blue">Blue</Tag>
<Tag closable color="green">Green</Tag>
<Tag closable color="yellow"><a href="https://github.com/ant-design/ant-design/issues/1862">Yellow</a></Tag>
<Tag closable color="red">Red</Tag>
</div>, mountNode);
````

View File

@ -1,11 +1,21 @@
---
order: 2
title: 动态添加和删除
title:
zh-CN: 动态添加和删除
en-US: Dynamically add and remove
---
## zh-CN
用数组生成一组标签,可以动态添加和删除。
> 使用 `afterClose` 删除时有动画效果。
使用 `afterClose` 删除时有动画效果。
## en-US
Generating a set of tag by array, you can dynamically add and remove.
Using 'afterClose' property, There are animated when a tag was removed.
````jsx
import { Tag, Button } from 'antd';
@ -15,9 +25,9 @@ const App = React.createClass({
getInitialState() {
return {
tags: [
{ key: 1, name: '不可移除' },
{ key: 2, name: '标签二' },
{ key: 3, name: '标签三' },
{ key: 1, name: 'Unremovable' },
{ key: 2, name: 'Tag 2' },
{ key: 3, name: 'Tag 3' },
],
};
},
@ -29,7 +39,7 @@ const App = React.createClass({
addTag() {
const tags = [...this.state.tags];
index += 1;
tags.push({ key: index, name: `新标签${index}` });
tags.push({ key: index, name: `New tag ${index}` });
this.setState({ tags });
},
render() {
@ -41,7 +51,7 @@ const App = React.createClass({
{tag.name}
</Tag>
)}
<Button size="small" type="dashed" onClick={this.addTag}>+ 添加标签</Button>
<Button size="small" type="dashed" onClick={this.addTag}>+ New tag</Button>
</div>
);
},

View File

@ -0,0 +1,22 @@
---
category: Components
type: Views
english: Tag
---
Tag for categorizing or markuping.
## When to use
- It can be used to tag by dimension or property.
- categorizing
## API
| Property | Description | Type | Default |
|--------------|-----------------------|----------|--------------|
| closable | Tag can be closed. | boolean | false |
| onClose | Callback when tag was closed | function(event)| - |
| afterClose | Callback when closed animation is complete | function(event)| - |
| color | Tag's color: `blue` `green` `yellow` `red` | string | - |