jim 7 лет назад
Родитель
Сommit
2c0e700f99

+ 1 - 1
src/components/Trend/demo/basic.md

@@ -10,7 +10,7 @@ import Trend from 'ant-design-pro/lib/Trend';
 
 ReactDOM.render(
   <div>
-    <Trend flag="up">12%</Trend>
+    <Trend flag="up" >12%</Trend>
     <Trend flag="down" style={{ marginLeft: 8 }}>11%</Trend>
   </div>
 , mountNode);

+ 17 - 0
src/components/Trend/demo/reverse.md

@@ -0,0 +1,17 @@
+---
+order: 0
+title: 颜色反转
+---
+
+在数值背后添加一个小图标来标识涨跌情况。
+
+````jsx
+import Trend from 'ant-design-pro/lib/Trend';
+
+ReactDOM.render(
+  <div>
+    <Trend flag="up" reverseColor={true} >12%</Trend>
+    <Trend flag="down" reverseColor={true} style={{ marginLeft: 8 }}>11%</Trend>
+  </div>
+, mountNode);
+````

+ 1 - 0
src/components/Trend/index.d.ts

@@ -4,6 +4,7 @@ export interface ITrendProps {
   colorful?: boolean;
   flag: 'up' | 'down';
   style?: React.CSSProperties;
+  reverseColor?: boolean;
 }
 
 export default class Trend extends React.Component<ITrendProps, any> {}

+ 2 - 1
src/components/Trend/index.js

@@ -3,11 +3,12 @@ import { Icon } from 'antd';
 import classNames from 'classnames';
 import styles from './index.less';
 
-const Trend = ({ colorful = true, flag, children, className, ...rest }) => {
+const Trend = ({ colorful = true, reverseColor = false, flag, children, className, ...rest }) => {
   const classString = classNames(
     styles.trendItem,
     {
       [styles.trendItemGrey]: !colorful,
+      [styles.reverseColor]: reverseColor && colorful,
     },
     className
   );

+ 7 - 0
src/components/Trend/index.less

@@ -27,4 +27,11 @@
   &.trendItemGrey .down {
     color: @text-color;
   }
+
+  &.reverseColor .up {
+    color: @green-6;
+  }
+  &.reverseColor .down {
+    color: @red-6;
+  }
 }

+ 1 - 0
src/components/Trend/index.md

@@ -19,3 +19,4 @@ order: 14
 |----------|------------------------------------------|-------------|-------|
 | colorful | 是否彩色标记 | Boolean | true |
 | flag | 上升下降标识:`up|down` | string | - |
+| reverseColor | 颜色反转 | Boolean | true |

+ 1 - 1
src/routes/Forms/BasicForm.js

@@ -151,7 +151,7 @@ export default class BasicForms extends PureComponent {
               }
             >
               {getFieldDecorator('weight')(<InputNumber placeholder="请输入" min={0} max={100} />)}
-              <span>%</span>
+              <span className="ant-form-text">%</span>
             </FormItem>
             <FormItem {...formItemLayout} label="目标公开" help="客户、邀评人默认被分享">
               <div>