diff --git a/ResultFail/src/Result/index.less b/ResultFail/src/Result/index.less new file mode 100644 index 0000000000000000000000000000000000000000..00c958793c541ca8e5ca4c6cba0aceda83d23dc3 --- /dev/null +++ b/ResultFail/src/Result/index.less @@ -0,0 +1,58 @@ +@import '~antd/lib/style/themes/default.less'; + +.result { + width: 72%; + margin: 0 auto; + text-align: center; + @media screen and (max-width: @screen-xs) { + width: 100%; + } + + .icon { + margin-bottom: 24px; + font-size: 72px; + line-height: 72px; + + & > .success { + color: @success-color; + } + + & > .error { + color: @error-color; + } + } + + .title { + margin-bottom: 16px; + color: @heading-color; + font-weight: 500; + font-size: 24px; + line-height: 32px; + } + + .description { + margin-bottom: 24px; + color: @text-color-secondary; + font-size: 14px; + line-height: 22px; + } + + .extra { + padding: 24px 40px; + text-align: left; + background: #fafafa; + border-radius: @border-radius-sm; + + @media screen and (max-width: @screen-xs) { + padding: 18px 20px; + } + } + + .actions { + margin-top: 32px; + + button:not(:last-child) { + margin-right: 8px; + } + } +} diff --git a/ResultFail/src/Result/index.tsx b/ResultFail/src/Result/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..63ba3ebc21b6db3f3e254e5686e48d37ea3e4ffc --- /dev/null +++ b/ResultFail/src/Result/index.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import classNames from 'classnames'; +import { Icon } from 'antd'; +import styles from './index.less'; + +export interface ResultProps { + actions?: React.ReactNode; + className?: string; + description?: React.ReactNode; + extra?: React.ReactNode; + style?: React.CSSProperties; + title?: React.ReactNode; + type: 'success' | 'error'; +} + +const Result: React.SFC = ({ + className, + type, + title, + description, + extra, + actions, + ...restProps +}) => { + const iconMap = { + error: , + success: , + }; + const clsString = classNames(styles.result, className); + return ( +
+
{iconMap[type]}
+
{title}
+ {description &&
{description}
} + {extra &&
{extra}
} + {actions &&
{actions}
} +
+ ); +}; + +export default Result; diff --git a/ResultFail/src/index.js b/ResultFail/src/index.tsx similarity index 76% rename from ResultFail/src/index.js rename to ResultFail/src/index.tsx index e5b77eb282ad6f6d46bdad2ccfe6e05b696e05d1..e410ba56cfcafc750245d127f33d7cfe915bc1d7 100644 --- a/ResultFail/src/index.js +++ b/ResultFail/src/index.tsx @@ -1,7 +1,8 @@ import React, { Fragment } from 'react'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Button, Icon, Card } from 'antd'; -import { Result } from 'ant-design-pro'; +import Result from './Result'; +import { GridContent } from '@ant-design/pro-layout'; const extra = ( @@ -9,7 +10,7 @@ const extra = ( style={{ fontSize: 16, color: 'rgba(0, 0, 0, 0.85)', - fontWeight: '500', + fontWeight: 500, marginBottom: 16, }} > @@ -50,14 +51,16 @@ const actions = ( ); export default () => ( - - - + + + + + ); diff --git a/ResultFail/src/locales/en-US.js b/ResultFail/src/locales/en-US.ts similarity index 100% rename from ResultFail/src/locales/en-US.js rename to ResultFail/src/locales/en-US.ts diff --git a/ResultFail/src/locales/zh-CN.js b/ResultFail/src/locales/zh-CN.ts similarity index 100% rename from ResultFail/src/locales/zh-CN.js rename to ResultFail/src/locales/zh-CN.ts diff --git a/ResultFail/src/locales/zh-TW.js b/ResultFail/src/locales/zh-TW.ts similarity index 100% rename from ResultFail/src/locales/zh-TW.js rename to ResultFail/src/locales/zh-TW.ts diff --git a/ResultSuccess/src/Result/index.less b/ResultSuccess/src/Result/index.less new file mode 100644 index 0000000000000000000000000000000000000000..00c958793c541ca8e5ca4c6cba0aceda83d23dc3 --- /dev/null +++ b/ResultSuccess/src/Result/index.less @@ -0,0 +1,58 @@ +@import '~antd/lib/style/themes/default.less'; + +.result { + width: 72%; + margin: 0 auto; + text-align: center; + @media screen and (max-width: @screen-xs) { + width: 100%; + } + + .icon { + margin-bottom: 24px; + font-size: 72px; + line-height: 72px; + + & > .success { + color: @success-color; + } + + & > .error { + color: @error-color; + } + } + + .title { + margin-bottom: 16px; + color: @heading-color; + font-weight: 500; + font-size: 24px; + line-height: 32px; + } + + .description { + margin-bottom: 24px; + color: @text-color-secondary; + font-size: 14px; + line-height: 22px; + } + + .extra { + padding: 24px 40px; + text-align: left; + background: #fafafa; + border-radius: @border-radius-sm; + + @media screen and (max-width: @screen-xs) { + padding: 18px 20px; + } + } + + .actions { + margin-top: 32px; + + button:not(:last-child) { + margin-right: 8px; + } + } +} diff --git a/ResultSuccess/src/Result/index.tsx b/ResultSuccess/src/Result/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..63ba3ebc21b6db3f3e254e5686e48d37ea3e4ffc --- /dev/null +++ b/ResultSuccess/src/Result/index.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import classNames from 'classnames'; +import { Icon } from 'antd'; +import styles from './index.less'; + +export interface ResultProps { + actions?: React.ReactNode; + className?: string; + description?: React.ReactNode; + extra?: React.ReactNode; + style?: React.CSSProperties; + title?: React.ReactNode; + type: 'success' | 'error'; +} + +const Result: React.SFC = ({ + className, + type, + title, + description, + extra, + actions, + ...restProps +}) => { + const iconMap = { + error: , + success: , + }; + const clsString = classNames(styles.result, className); + return ( +
+
{iconMap[type]}
+
{title}
+ {description &&
{description}
} + {extra &&
{extra}
} + {actions &&
{actions}
} +
+ ); +}; + +export default Result; diff --git a/ResultSuccess/src/index.js b/ResultSuccess/src/index.tsx similarity index 88% rename from ResultSuccess/src/index.js rename to ResultSuccess/src/index.tsx index a15594e2fb761f7e59cd8f3db6194bebc8d93680..64dca84d11361b7799ce5792f6d415a8f9175918 100644 --- a/ResultSuccess/src/index.js +++ b/ResultSuccess/src/index.tsx @@ -1,7 +1,8 @@ import React, { Fragment } from 'react'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Button, Row, Col, Icon, Steps, Card } from 'antd'; -import { Result } from 'ant-design-pro'; +import Result from './Result'; +import { GridContent } from '@ant-design/pro-layout'; const { Step } = Steps; @@ -43,7 +44,7 @@ const extra = ( style={{ fontSize: 16, color: 'rgba(0, 0, 0, 0.85)', - fontWeight: '500', + fontWeight: 500, marginBottom: 20, }} > @@ -128,14 +129,16 @@ const actions = ( ); export default () => ( - - - + + + + + ); diff --git a/ResultSuccess/src/locales/en-US.js b/ResultSuccess/src/locales/en-US.ts similarity index 100% rename from ResultSuccess/src/locales/en-US.js rename to ResultSuccess/src/locales/en-US.ts diff --git a/ResultSuccess/src/locales/zh-CN.js b/ResultSuccess/src/locales/zh-CN.ts similarity index 100% rename from ResultSuccess/src/locales/zh-CN.js rename to ResultSuccess/src/locales/zh-CN.ts diff --git a/ResultSuccess/src/locales/zh-TW.js b/ResultSuccess/src/locales/zh-TW.ts similarity index 100% rename from ResultSuccess/src/locales/zh-TW.js rename to ResultSuccess/src/locales/zh-TW.ts diff --git a/package.json b/package.json index 23519829217a26c8a6336ba4d05ae453843abbcc..093481544572d524bfd3de777d011b3585c542a1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "dev": "cross-env PAGES_PATH='Monitor/src' umi dev", + "dev": "cross-env PAGES_PATH='ResultFail/src' umi dev", "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",