From 851ad244ced391cbfdf0ff062ff4427503452c78 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 1 Sep 2023 14:50:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=80=BB=E6=95=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/charts/StatisticCard.jsx | 27 +++++++++++++++++++++++++++ src/views/Home.jsx | 27 ++------------------------- 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 src/charts/StatisticCard.jsx diff --git a/src/charts/StatisticCard.jsx b/src/charts/StatisticCard.jsx new file mode 100644 index 0000000..0de1fcc --- /dev/null +++ b/src/charts/StatisticCard.jsx @@ -0,0 +1,27 @@ +import { observer } from "mobx-react"; +import { Card, Statistic, Progress } from 'antd'; +import { ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons'; + +export default observer((props) => { + const valueStyle = { color: props.VSrate < 0 ? '#cf1322' : '#3f8600' }; + const VSIcon = () => (props.VSrate < 0 ? : ); + return ( + + + + {props.VSrate} + % + + ) + } + {...props} + /> + {props.showProgress !== false && `${props.KPIrate}%`} />} + + ); +}); diff --git a/src/views/Home.jsx b/src/views/Home.jsx index 2d41cb9..9f5b9ca 100644 --- a/src/views/Home.jsx +++ b/src/views/Home.jsx @@ -1,9 +1,10 @@ import { useContext, useEffect } from 'react'; import { observer } from 'mobx-react'; -import { Row, Col, Spin, Card, Statistic, Progress } from 'antd'; +import { Row, Col, Spin, } from 'antd'; import { stores_Context } from '../config'; import { useNavigate } from 'react-router-dom'; import { SlackOutlined, SketchOutlined, AntCloudOutlined, RedditOutlined, GithubOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons'; +import StatisticCard from './../charts/StatisticCard'; import { empty } from './../utils/commons'; import './home.css'; @@ -22,30 +23,6 @@ export default observer(() => { return () => {}; }, []); - const StatisticCard = (props) => { - const valueStyle = { color: props.VSrate < 0 ? '#cf1322' : '#3f8600' }; - const VSIcon = () => (props.VSrate < 0 ? : ); - return ( - - - - {props.VSrate} - % - - ) - } - {...props} - /> - {props.showProgress !== false && `${props.KPIrate}%`} />} - - ); - }; - const layoutProps = { gutter: { xs: 8, sm: 8, lg: 16 }, lg: { span: 6 },