From 784984d1bfa910b7b3b43df2fa684d6b3181533b Mon Sep 17 00:00:00 2001 From: HeskeyBaozi Date: Sun, 16 Sep 2018 19:32:11 +0800 Subject: [PATCH] remove progress icon interface --- .../__tests__/__snapshots__/demo.test.js.snap | 899 ------------------ components/progress/demo/suffix.md | 63 -- components/progress/index.en-US.md | 1 - components/progress/index.zh-CN.md | 1 - components/progress/progress.tsx | 10 +- 5 files changed, 2 insertions(+), 972 deletions(-) delete mode 100644 components/progress/demo/suffix.md diff --git a/components/progress/__tests__/__snapshots__/demo.test.js.snap b/components/progress/__tests__/__snapshots__/demo.test.js.snap index 3fd1743892..0d99eac699 100644 --- a/components/progress/__tests__/__snapshots__/demo.test.js.snap +++ b/components/progress/__tests__/__snapshots__/demo.test.js.snap @@ -1026,902 +1026,3 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = ` `; - -exports[`renders ./components/progress/demo/suffix.md correctly 1`] = ` -
-

- Icon -

-

- Use Object -

-
-
-
-
-
-
-
- - 30% - -
-
-
-
-
-
-
-
-
- - 50% - -
-
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - 75% - -
-
-
-
- - - - - - - - - -
-
-
-
- - - - - - - - - -
-
-

- Use Object (only Success) -

-
-
-
-
-
-
-
- - 30% - -
-
-
-
-
-
-
-
-
- - 50% - -
-
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - 75% - -
-
-
-
- - - - - - - - - -
-
-
-
- - - - - - - - - -
-
-

- Use React Node -

-
-
-
-
-
-
-
- - 30% - -
-
-
-
-
-
-
-
-
- - 50% - -
-
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - 75% - -
-
-
-
- - - - - - - - - -
-
-
-
- - - - - - - - - -
-
-
-`; diff --git a/components/progress/demo/suffix.md b/components/progress/demo/suffix.md deleted file mode 100644 index f72bbc0966..0000000000 --- a/components/progress/demo/suffix.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -order: 11 -debug: true -title: - zh-CN: 后缀图标 - en-US: Suffix ---- - -## zh-CN - -标准的进度条。 - -## en-US - -A standard progress bar. - -````jsx -import { Progress, Icon } from 'antd'; - -const smileIcon = ; -const mehIcon = ; -const heartIcon = ; -const icon = { - success: smileIcon, - exception: mehIcon, -}; -const iconSuccessOnly = { - success: smileIcon, -}; - -ReactDOM.render( -
-

Icon

-

Use Object

- - - - - - - - -

Use Object (only Success)

- - - - - - - - -

Use React Node

- - - - - - - - -
, - mountNode); -```` diff --git a/components/progress/index.en-US.md b/components/progress/index.en-US.md index baf04e25ea..c84be03220 100644 --- a/components/progress/index.en-US.md +++ b/components/progress/index.en-US.md @@ -20,7 +20,6 @@ If it will take a long time to complete an operation, you can use `Progress` to | format | template function of the content | function(percent, successPercent) | `percent => percent + '%'` | | gapDegree `(type=circle)` | the gap degree of half circle, 0 ~ 360 | number | 0 | | gapPosition `(type=circle)` | the gap position, options: `top` `bottom` `left` `right` | string | `top` | -| icon | custom progress icon | ReactElement \| { success?: ReactNode, exception?: ReactNode } | - | | percent | to set the completion percentage | number | 0 | | showInfo | whether to display the progress value and the status icon | boolean | true | | status | to set the status of the Progress, options: `success` `exception` `active` | string | - | diff --git a/components/progress/index.zh-CN.md b/components/progress/index.zh-CN.md index 28bfb38821..58f8058c71 100644 --- a/components/progress/index.zh-CN.md +++ b/components/progress/index.zh-CN.md @@ -21,7 +21,6 @@ title: Progress | format | 内容的模板函数 | function(percent, successPercent) | `percent => percent + '%'` | | gapDegree `(type=circle)` | 圆形进度条缺口角度,可取值 0 ~ 360 | number | 0 | | gapPosition `(type=circle)` | 圆形进度条缺口位置 | Enum{ 'top', 'bottom', 'left', 'right' } | `top` | -| icon | 自定义的进度条图标 | ReactElement \| { success?: ReactNode, exception?: ReactNode } | - | | percent | 百分比 | number | 0 | | showInfo | 是否显示进度数值或状态图标 | boolean | true | | status | 状态,可选:`success` `exception` `active` | string | - | diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 0b45f92bb0..e2933ade35 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -31,7 +31,6 @@ export interface ProgressProps { gapDegree?: number; gapPosition?: 'top' | 'bottom' | 'left' | 'right'; size?: ProgressSize; - icon?: React.ReactElement | { success?: React.ReactNode, exception?: React.ReactNode }; } const validProgress = (progress: number | undefined) => { @@ -76,7 +75,6 @@ export default class Progress extends React.Component { const { prefixCls, className, percent = 0, status, format, trailColor, size, successPercent, type, strokeWidth, width, showInfo, gapDegree = 0, gapPosition, strokeColor, strokeLinecap = 'round', - icon, ...restProps } = props; const progressStatus = parseInt((successPercent ? successPercent.toString() : percent.toString()), 10) >= 100 && @@ -91,13 +89,9 @@ export default class Progress extends React.Component { if (format || (progressStatus !== 'exception' && progressStatus !== 'success')) { text = textFormatter(validProgress(percent), validProgress(successPercent)); } else if (progressStatus === 'exception') { - let exceptionIcon = typeof icon === 'object' && !React.isValidElement(icon) && (icon as any).exception; - text = exceptionIcon || (React.isValidElement(icon) && icon) || - ; + text = ; } else if (progressStatus === 'success') { - let successIcon = typeof icon === 'object' && !React.isValidElement(icon) && (icon as any).success; - text = successIcon || (React.isValidElement(icon) && icon) || - ; + text = ; } progressInfo = {text}; }