diff --git a/components/icon/index.jsx b/components/icon/index.jsx deleted file mode 100644 index 22a6bc58a1..0000000000 --- a/components/icon/index.jsx +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -const react_1 = require('react'); -const splitObject_1 = require('../_util/splitObject'); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = props => { - const [{ type, className = '' }, others] = splitObject_1.default(props, ['type', 'className']); - let className2 = `${className} anticon anticon-${type}`.trim(); - return ; -}; diff --git a/components/message/demo/duration.md b/components/message/demo/duration.md index f662465f2a..af1b565207 100644 --- a/components/message/demo/duration.md +++ b/components/message/demo/duration.md @@ -1,17 +1,25 @@ --- order: 2 -title: 修改延时 +title: + zh-CN: 修改延时 + en-US: Customize duration --- +## zh-CN + 自定义时长 `10s`,默认时长为 `1.5s`。 +## en-US + +Customize message display duration from default `1.5s` to `10s`. + ````jsx import { message, Button } from 'antd'; const success = function () { - message.success('这是一条成功的提示,并将于10秒后消失', 10); + message.success('This is a prompt message for success, and it will disappear in 10 seconds', 10); }; -ReactDOM.render( +ReactDOM.render( , mountNode); ```` diff --git a/components/message/demo/info.md b/components/message/demo/info.md index 16c6a24e38..918436284d 100644 --- a/components/message/demo/info.md +++ b/components/message/demo/info.md @@ -1,17 +1,25 @@ --- order: 0 -title: 普通提示 +title: + zh-CN: 普通提示 + en-US: Normal prompt --- +## zh-CN + 信息提醒反馈。 +## en-US + +Normal messages as feedbacks. + ````jsx import { message, Button } from 'antd'; const info = function () { - message.info('这是一条普通的提醒'); + message.info('This is a normal message'); }; -ReactDOM.render( +ReactDOM.render( , mountNode); ```` diff --git a/components/message/demo/loading.md b/components/message/demo/loading.md index 5d11e137cb..71a8b4d480 100644 --- a/components/message/demo/loading.md +++ b/components/message/demo/loading.md @@ -1,19 +1,27 @@ --- order: 3 -title: 加载中 +title: + zh-CN: 加载中 + en-US: Message of loading --- +## zh-CN + 进行全局 loading,异步自行移除。 +## en-US + +Display a global loading indicator, which is dismissed by itself asynchronously. + ````jsx import { message, Button } from 'antd'; const success = function () { - let hide = message.loading('正在执行中...', 0); - // 异步手动移除 + let hide = message.loading('Action in progress..', 0); + // Dismiss manually and asynchronously setTimeout(hide, 2500); }; -ReactDOM.render( +ReactDOM.render( , mountNode); ```` diff --git a/components/message/demo/other.md b/components/message/demo/other.md index 99aea5785d..c5e07f9251 100644 --- a/components/message/demo/other.md +++ b/components/message/demo/other.md @@ -1,29 +1,37 @@ --- order: 1 -title: 其他提示类型 +title: + zh-CN: 其他提示类型 + en-US: Other types of message --- +## zh-CN + 包括成功、失败、警告。 +## en-US + +Messages of success, error and warning types. + ````jsx import { message, Button } from 'antd'; const success = function () { - message.success('这是一条成功提示'); + message.success('This is a message of success'); }; const error = function () { - message.error('这是一条报错提示'); + message.error('This is a message of error'); }; const warning = function () { - message.warning('这是一条警告提示'); + message.warning('This is message of warning'); }; ReactDOM.render(
- - - + + +
, mountNode); ```` diff --git a/components/message/index.en-US.md b/components/message/index.en-US.md new file mode 100644 index 0000000000..985d93215c --- /dev/null +++ b/components/message/index.en-US.md @@ -0,0 +1,46 @@ +--- +category: Components +type: Presentation +noinstant: true +english: Message +--- + +Display global messages as feedbacks to user operations. + +## When To Use + +- To provide feedbacks such as success, warning, error etc. +- A message is displayed at top and center and will be dismissed automatically, as a non-interrupting light-weighted prompt. + +## API + +- `message.success(content, duration)` +- `message.error(content, duration)` +- `message.info(content, duration)` +- `message.warning(content, duration)` +- `message.warn(content, duration)` +- `message.loading(content, duration)` + +This components provides 4 static methods, with arguments as following: + +| Argument | Description | Type | Default | +|------------|------------------------------------|--------------------------|--------------| +| content | content of the message | React.Element or String | - | +| duration | time before auto-dismiss,in seconds | number | 1.5 | + +Methods for global configuration and destruction are also provided: + +- `message.config(options)` +- `message.destroy()` + +```js +message.config({ + top: 100, + duration: 2, +}); +``` + +| Argument | Description | Type | Default | +|------------|------------------------------------|--------------------------|-------------| +| top | distance to top | Number | 24px | +| duration | time before auto-dismiss,in seconds | Number | 1.5 | diff --git a/components/message/index.md b/components/message/index.zh-CN.md similarity index 100% rename from components/message/index.md rename to components/message/index.zh-CN.md