Commit cf1553fb authored by 陈帅's avatar 陈帅

Result finish

parent 0b1b1122
@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;
}
}
}
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<ResultProps> = ({
className,
type,
title,
description,
extra,
actions,
...restProps
}) => {
const iconMap = {
error: <Icon className={styles.error} type="close-circle" theme="filled" />,
success: <Icon className={styles.success} type="check-circle" theme="filled" />,
};
const clsString = classNames(styles.result, className);
return (
<div className={clsString} {...restProps}>
<div className={styles.icon}>{iconMap[type]}</div>
<div className={styles.title}>{title}</div>
{description && <div className={styles.description}>{description}</div>}
{extra && <div className={styles.extra}>{extra}</div>}
{actions && <div className={styles.actions}>{actions}</div>}
</div>
);
};
export default Result;
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale';
import { Button, Icon, Card } from 'antd'; 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 = ( const extra = (
<Fragment> <Fragment>
...@@ -9,7 +10,7 @@ const extra = ( ...@@ -9,7 +10,7 @@ const extra = (
style={{ style={{
fontSize: 16, fontSize: 16,
color: 'rgba(0, 0, 0, 0.85)', color: 'rgba(0, 0, 0, 0.85)',
fontWeight: '500', fontWeight: 500,
marginBottom: 16, marginBottom: 16,
}} }}
> >
...@@ -50,14 +51,16 @@ const actions = ( ...@@ -50,14 +51,16 @@ const actions = (
); );
export default () => ( export default () => (
<Card bordered={false}> <GridContent>
<Result <Card bordered={false}>
type="error" <Result
title={formatMessage({ id: 'BLOCK_NAME.error.title' })} type="error"
description={formatMessage({ id: 'BLOCK_NAME.error.description' })} title={formatMessage({ id: 'BLOCK_NAME.error.title' })}
extra={extra} description={formatMessage({ id: 'BLOCK_NAME.error.description' })}
actions={actions} extra={extra}
style={{ marginTop: 48, marginBottom: 16 }} actions={actions}
/> style={{ marginTop: 48, marginBottom: 16 }}
</Card> />
</Card>
</GridContent>
); );
@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;
}
}
}
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<ResultProps> = ({
className,
type,
title,
description,
extra,
actions,
...restProps
}) => {
const iconMap = {
error: <Icon className={styles.error} type="close-circle" theme="filled" />,
success: <Icon className={styles.success} type="check-circle" theme="filled" />,
};
const clsString = classNames(styles.result, className);
return (
<div className={clsString} {...restProps}>
<div className={styles.icon}>{iconMap[type]}</div>
<div className={styles.title}>{title}</div>
{description && <div className={styles.description}>{description}</div>}
{extra && <div className={styles.extra}>{extra}</div>}
{actions && <div className={styles.actions}>{actions}</div>}
</div>
);
};
export default Result;
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale';
import { Button, Row, Col, Icon, Steps, Card } from 'antd'; 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; const { Step } = Steps;
...@@ -43,7 +44,7 @@ const extra = ( ...@@ -43,7 +44,7 @@ const extra = (
style={{ style={{
fontSize: 16, fontSize: 16,
color: 'rgba(0, 0, 0, 0.85)', color: 'rgba(0, 0, 0, 0.85)',
fontWeight: '500', fontWeight: 500,
marginBottom: 20, marginBottom: 20,
}} }}
> >
...@@ -128,14 +129,16 @@ const actions = ( ...@@ -128,14 +129,16 @@ const actions = (
); );
export default () => ( export default () => (
<Card bordered={false}> <GridContent>
<Result <Card bordered={false}>
type="success" <Result
title={formatMessage({ id: 'BLOCK_NAME.success.title' })} type="success"
description={formatMessage({ id: 'BLOCK_NAME.success.description' })} title={formatMessage({ id: 'BLOCK_NAME.success.title' })}
extra={extra} description={formatMessage({ id: 'BLOCK_NAME.success.description' })}
actions={actions} extra={extra}
style={{ marginTop: 48, marginBottom: 16 }} actions={actions}
/> style={{ marginTop: 48, marginBottom: 16 }}
</Card> />
</Card>
</GridContent>
); );
{ {
"private": true, "private": true,
"scripts": { "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:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style", "lint": "eslint --ext .js src mock tests && npm run lint:style",
"lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment