[docs] translate menu,popover,popconfirm (#2713)

This commit is contained in:
Winsky 2016-08-26 14:42:41 +08:00 committed by Benjy Cui
parent 50c4367a15
commit 6e94e7b7a4
20 changed files with 251 additions and 14 deletions

10
components/menu/demo/horizontal.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 0
title: 顶部导航
title:
zh-CN: 顶部导航
en-US: Top Navigation
---
## zh-CN
水平的顶部导航菜单。
## en-US
Horizontal top navigation menu.
````jsx
import { Menu, Icon } from 'antd';
const SubMenu = Menu.SubMenu;

10
components/menu/demo/sider-current.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 2
title: 只展开当前父级菜单
title:
zhCN: 只展开当前父级菜单
en-US: only to open the current parant menu
---
## zh-CN
点击菜单,收起其他展开的所有菜单,保持菜单聚焦简洁。
## en-US
Click the menu and you will see that all the other menus gets collapsed to keep the entire menu compact.
````jsx
import { Menu, Icon } from 'antd';
const SubMenu = Menu.SubMenu;

10
components/menu/demo/sider.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 1
title: 内嵌菜单
title:
zh-CN: 内嵌菜单
en-US: Vertical menu with inline children
---
## zh-CN
垂直菜单,子菜单内嵌在菜单区域。
## en-US
Vertical menu with inline submenus.
````jsx
import { Menu, Icon } from 'antd';
const SubMenu = Menu.SubMenu;

10
components/menu/demo/switch-mode.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 5
title: 切换菜单类型
title:
zh-CN: 切换菜单类型
en-US: Switch the menu type
---
## zh-CN
展示动态切换模式。
## en-US
Show the dynamic switching mode (between 'inline' and 'vertical').
````jsx
import { Menu, Icon, Switch } from 'antd';
const SubMenu = Menu.SubMenu;

10
components/menu/demo/theme.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 4
title: 主题
title:
zh-CN: 主题
en-US: Menu Themes
---
## zh-CN
内建了两套主题 `light|dark`,默认 `light`
## en-US
There are two built-in themes: 'light' and 'dark'. The default value is 'light'.
````jsx
import { Menu, Icon, Switch } from 'antd';
const SubMenu = Menu.SubMenu;

10
components/menu/demo/vertical.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 3
title: 垂直菜单
title:
zh-CN: 垂直菜单
en-US: Vertical menu
---
## zh-CN:
子菜单是弹出的形式。
## en-US:
Submenus open as pop-ups.
````jsx
import { Menu, Icon } from 'antd';
const SubMenu = Menu.SubMenu;

View File

@ -0,0 +1,69 @@
---
category: Components
chinese: 导航菜单
cols: 1
type: Navigation
english: Menu
---
Menu list of Navigation.
## When to use
Navigation menu is important for a website, it helps users jump from one site section to another quickly. Mostly, it includes top navigation and side navigation. Top navigation provides all the category and functions of the website. Side navigation provides the Multi-level structure of the website.
More layout and samples: [layout](/docs/spec/layout).
```html
<Menu>
<Menu.Item>Menu</Menu.Item>
<SubMenu title="SubMenu">
<Menu.Item>SubMenuItem</Menu.Item>
</SubMenu>
</Menu>
```
## API
### Menu props
| Param | Description | Type | Default value |
|----------|---------------|----------|--------------|
| theme | color of the theme | String: `light` `dark` | `light` |
| mode | type of the menu; vertical, horizontal, and inline modes are supported | String: vertical horizontal inline | vertical |
| selectedKeys | array with the keys of currently selected menu items | Array | |
| defaultSelectedKeys | array with the keys of default selected menu items | Array | |
| openKeys | array with the keys of currently opened sub menus | Array | |
| defaultOpenKeys | array with the keys of default opened sub menus | | |
| onOpen | callback of the opened sub menu | Function({ key, item, keyPath }) | |
| onClose | callback of the closed sub menu | Function({ key, item, keyPath }) | |
| onSelect | callback of the selected item | Function({ item, key, selectedKeys }) | none |
| onDeselect | callback of the deselected item, only supported for multiple mode | Function({ item, key, selectedKeys }) | - |
| onClick | callback of the clicked menu item, params: {item, key, keyPath} | function | - |
| style | style of the root node | Object | |
> More options in [rc-menu](https://github.com/react-component/menu#api)
### Menu.Item props
| Param | Description | Type | Default value |
|----------|----------------|----------|--------------|
| disabled | disabled or not | Boolean | false |
| key | unique id of the menu item | String | |
### Menu.SubMenu props
| Param | Description | Type | Default value |
|----------|----------------|----------|--------------|
| disabled | disabled or not | Boolean | false |
| key | unique id of the menu item | String | |
| title | title of the sub menu | String or React.Element | |
| children | sub menus or sub menu items | (MenuItem or SubMenu)[] | |
| onTitleClick | callback of the clicked sub menu title | Function({ eventKey, domEvent }) | |
### Menu.ItemGroup props
| Param | Description | Type | Default value |
|----------|----------------|----------|--------------|
| title | title of the group | String or React.Element | |
| children | sub menu items | MenuItem[] | |

10
components/popconfirm/demo/basic.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 0
title: 基本
title:
zh-CN: 基本
en-US: Basic
---
## zh-CN
最简单的用法。
## en-US
The basic example.
````jsx
import { Popconfirm, message } from 'antd';

10
components/popconfirm/demo/dynamic-trigger.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 3
title: 条件触发
title:
zh-CN: 条件触发
en-US: Conditional trigger
---
## zh-CN
可以判断是否需要弹出。
## en-US
Make it pop up under some conditions.
````jsx
import { Popconfirm, Switch, message } from 'antd';

10
components/popconfirm/demo/locale.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 2
title: 国际化
title:
zh-CN: 国际化
en-US: Internationalization
---
## zh-CN
设置 `okText` `cancelText` 以自定义按钮文字。
## en-US
Set `okText` and `cancelText` props to customise the buttons' labels.
````jsx
import { Popconfirm } from 'antd';

10
components/popconfirm/demo/placement.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 1
title: 位置
title:
zh-CN: 位置
en-US: Placement
---
## zh-CN
位置有十二个方向。
## en-US
There are 12 `placement` options available.
````jsx
import { Popconfirm, message, Button } from 'antd';

View File

@ -0,0 +1,27 @@
---
category: Components
chinese: 气泡确认框
type: Views
english: Popconfirm
---
A simple and compact confirmation dialog of an action.
## When to use
A simple and compact dialog used for asking an user confirmation.
The difference with `confirm` is more lightweight than the static popped full-screen confirm modal.
## API
| Param | Description | Type | Default value |
|-----------|------------------------------------------|---------------|--------|
| placement | position of the confirmation box, optional `top/left/right/bottom` `topLeft/topRight/bottomLeft/bottomRight` `leftTop/leftBottom/rightTop/rightBottom` | string | top |
| title | title of the confirmation box | React.Element | none |
| onConfirm | callback of confirmation | function | none |
| onCancel | callback of cancel | function | none |
| onVisibleChange | callback of the visible attribute changed | function(visible) | none |
| okText | text of the confirmation button | String | Confirm |
| cancelText| text of the cancel button | String | Cancel |
| openClassName | class name of the trigger, using for highlighting the trigger while triggered | string | ant-popover-open |

10
components/popover/demo/basic.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 0
title: 基本
title:
zh-CN: 基本
en-US: Basic
---
## zh-CN
最简单的用法,浮层的大小由内容区域决定。
## en-US
The most basic example. The size of the floating layer depends on the contents region.
````jsx
import { Popover, Button } from 'antd';

10
components/popover/demo/control.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 3
title: 从浮层内关闭
title:
zh-CN: 从浮层内关闭
en-US: Controlling the close of the dialog
---
## zh-CN
使用 `visible` 属性控制浮层显示。
## en-US
Use `visible` prop to control the display of the card.
````jsx
import { Popover, Button } from 'antd';

10
components/popover/demo/placement.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 1
title: 位置
title:
zh-CN: 位置
en-US: Placement
---
## zh-CN
位置有十二个方向。
## en-US
There are 12 `placement` options available.
````jsx
import { Popover, Button } from 'antd';

10
components/popover/demo/triggerType.md Normal file → Executable file
View File

@ -1,10 +1,18 @@
---
order: 2
title: 三种触发方式
title:
zh-CN: 三种触发方式
en-US: Three ways to trigger
---
## zh-CN
鼠标移入、聚集、点击。
## en-US
Mouse to click, focus and move in.
````jsx
import { Popover, Button } from 'antd';

View File

@ -0,0 +1,29 @@
---
category: Components
chinese: 气泡卡片
type: Views
english: Popover
---
The floating card popped by clicking or hovering.
## When to use
A simple and pop-up menu to provide more information and operations of an action.
Comparing with `Tooltip`, besides information `Popover` card can also provide action elements like links and buttons.
## API
| Param | Description | Type | Default value |
|-----------|------------------------------------------|---------------|--------|
| trigger | triggering mode: can be hover, focus, or click. | string | hover |
| placement | position of the cardoptional `top/left/right/bottom` `topLeft/topRight/bottomLeft/bottomRight` `leftTop/leftBottom/rightTop/rightBottom` | string | top |
| title | title of the card | React.Element | none |
| content | content of the card | React.Element | none |
| overlayClassName | class name of the card | string | none |
| overlayStyle | style of the card | object | none |
| visible | make the float card visible or not | boolean | false |
| onVisibleChange | callback of the visible attribute changed | function | none |
| getTooltipContainer | rendered to the root of the menu. Default rendered to the body dom. If gets any problem of the menu while scrolling. Try to make the root the dom scrolled, and make it position relative. [Sample](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
| openClassName | class name of the trigger, using for highlighting the trigger while triggered | string | ant-popover-open |