Skip to content

Commit

Permalink
DigitalFlop 添加 rowGap 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhiyuyou committed Jun 14, 2020
1 parent 875065e commit a6f3aaa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Perfect

- **BorderBox:** 添加 backgroundColor prop.
- **DigitalFlop:** 添加 rowGap 配置.
- **CapsuleChart:** 添加 showVal 配置.
- **ActiveRightChart:** 添加 showOriginalValue 配置.

Expand Down
1 change: 1 addition & 0 deletions src/components/capsuleChart/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
border-radius: 5px;

div {
position: relative;
height: 8px;
margin-top: 1px;
border-radius: 5px;
Expand Down
10 changes: 8 additions & 2 deletions src/components/digitalFlop/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ const defaultConfig = {
* @example textAlign = 'center' | 'left' | 'right'
*/
textAlign: 'center',
/**
* @description rowGap
* @type {Number}
*@default rowGap = 0
*/
rowGap: 0,
/**
* @description Text style configuration
* @type {Object} {CRender Class Style}
Expand Down Expand Up @@ -81,15 +87,15 @@ const DigitalFlop = ({ config = {}, className, style }) => {
})
}

function getShape({ number, content, toFixed, textAlign }) {
function getShape({ number, content, toFixed, textAlign, rowGap }) {
const [w, h] = rendererRef.current.area

const position = [w / 2, h / 2]

if (textAlign === 'left') position[0] = 0
if (textAlign === 'right') position[0] = w

return { number, content, toFixed, position }
return { number, content, toFixed, position, rowGap }
}

function getStyle({ style, textAlign }) {
Expand Down

0 comments on commit a6f3aaa

Please sign in to comment.