From 1d31618f632b0489aa88dd6e6603515bf66d256d Mon Sep 17 00:00:00 2001
From: nikogu <644506165@qq.com>
Date: Tue, 21 Nov 2017 10:34:53 +0800
Subject: [PATCH] add SimpleCard style to fixed:
https://github.com/ant-design/ant-design-pro/issues/192
---
src/components/Charts/ChartCard/index.js | 40 +++++++++++-----
src/components/Charts/ChartCard/index.less | 27 ++++++++++-
src/components/Charts/demo/chart-card.md | 55 +++++++++++++++-------
3 files changed, 92 insertions(+), 30 deletions(-)
diff --git a/src/components/Charts/ChartCard/index.js b/src/components/Charts/ChartCard/index.js
index fd442673..04cd70c7 100644
--- a/src/components/Charts/ChartCard/index.js
+++ b/src/components/Charts/ChartCard/index.js
@@ -1,29 +1,45 @@
import React from 'react';
import { Card, Spin } from 'antd';
+import classNames from 'classnames';
import styles from './index.less';
const ChartCard = ({
- loading = false, contentHeight, title, action, total, footer, children, ...rest
+ loading = false, contentHeight, title, avatar, action, total, footer, children, ...rest
}) => {
const content = (
-
-
{title}
-
{action}
+
+
+ {
+ avatar
+ }
+
+
+
+ {title}
+ {action}
+
+ {
+ // eslint-disable-next-line
+ total && (
)
+ }
+
{
- // eslint-disable-next-line
- total &&
+ children && (
+
+ )
}
-
{
footer && (
-
+
{footer}
)
diff --git a/src/components/Charts/ChartCard/index.less b/src/components/Charts/ChartCard/index.less
index da65ef57..bdc573b1 100644
--- a/src/components/Charts/ChartCard/index.less
+++ b/src/components/Charts/ChartCard/index.less
@@ -2,10 +2,32 @@
.chartCard {
position: relative;
+ .chartTop {
+ position: relative;
+ overflow: hidden;
+ width: 100%;
+ }
+ .chartTopMargin {
+ margin-bottom: 12px;
+ }
+ .chartTopHasMargin {
+ margin-bottom: 20px;
+ }
+ .metaWrap {
+ float: left;
+ }
+ .avatar {
+ position: relative;
+ top: 4px;
+ float: left;
+ margin-right: 20px;
+ img {
+ border-radius: 100%;
+ }
+ }
.meta {
color: @text-color-secondary;
font-size: @font-size-base;
- position: relative;
line-height: 22px;
height: 22px;
}
@@ -46,4 +68,7 @@
position: relative;
}
}
+ .footerMargin {
+ margin-top: 20px;
+ }
}
diff --git a/src/components/Charts/demo/chart-card.md b/src/components/Charts/demo/chart-card.md
index 424bb6f8..32abac47 100644
--- a/src/components/Charts/demo/chart-card.md
+++ b/src/components/Charts/demo/chart-card.md
@@ -8,25 +8,46 @@ title: 图表卡片
````jsx
import { ChartCard, yuan, Field } from 'ant-design-pro/lib/Charts';
import Trend from 'ant-design-pro/lib/Trend';
-import { Tooltip, Icon } from 'antd';
+import { Row, Col, Icon, Tooltip } from 'antd';
import numeral from 'numeral';
ReactDOM.render(
-
}
- total={yuan(126560)}
- footer={}
- contentHeight={46}
- >
-
- 周同比
- 12%
-
-
- 日环比
- 11%
-
-
+
+
+ }
+ total={yuan(126560)}
+ footer={}
+ contentHeight={46}
+ >
+
+ 周同比
+ 12%
+
+
+ 日环比
+ 11%
+
+
+
+
+ }
+ action={}
+ total={yuan(126560)}
+ footer={}
+ />
+
+
+ }
+ action={}
+ total={yuan(126560)}
+ />
+
+
, mountNode);
````
--
GitLab