From 40ac8b52674c5d3d86dcc6dee37d5e4678d931bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 19 Apr 2019 12:19:40 +0800 Subject: [PATCH] UserRegisterResult finish --- UserRegisterResult/src/Result/index.less | 58 +++++++++++++++++++ UserRegisterResult/src/Result/index.tsx | 41 +++++++++++++ .../src/{index.js => index.tsx} | 5 +- .../src/locales/{en-US.js => en-US.ts} | 0 .../src/locales/{zh-CN.js => zh-CN.ts} | 0 .../src/locales/{zh-TW.js => zh-TW.ts} | 0 6 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 UserRegisterResult/src/Result/index.less create mode 100644 UserRegisterResult/src/Result/index.tsx rename UserRegisterResult/src/{index.js => index.tsx} (86%) rename UserRegisterResult/src/locales/{en-US.js => en-US.ts} (100%) rename UserRegisterResult/src/locales/{zh-CN.js => zh-CN.ts} (100%) rename UserRegisterResult/src/locales/{zh-TW.js => zh-TW.ts} (100%) diff --git a/UserRegisterResult/src/Result/index.less b/UserRegisterResult/src/Result/index.less new file mode 100644 index 00000000..00c95879 --- /dev/null +++ b/UserRegisterResult/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/UserRegisterResult/src/Result/index.tsx b/UserRegisterResult/src/Result/index.tsx new file mode 100644 index 00000000..63ba3ebc --- /dev/null +++ b/UserRegisterResult/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/UserRegisterResult/src/index.js b/UserRegisterResult/src/index.tsx similarity index 86% rename from UserRegisterResult/src/index.js rename to UserRegisterResult/src/index.tsx index 9bd63060..1c838192 100644 --- a/UserRegisterResult/src/index.js +++ b/UserRegisterResult/src/index.tsx @@ -2,8 +2,9 @@ import React from 'react'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Button } from 'antd'; import Link from 'umi/link'; -import { Result } from 'ant-design-pro'; +import Result from './Result'; import styles from './style.less'; +import { RouteChildrenProps } from 'react-router'; const actions = (
@@ -20,7 +21,7 @@ const actions = (
); -const PAGE_NAME_UPPER_CAMEL_CASE = ({ location }) => ( +const PAGE_NAME_UPPER_CAMEL_CASE: React.SFC = ({ location }) => (