Skip to content

Commit

Permalink
fix: badge offset x y axis order error and support number type #99
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Aug 8, 2018
1 parent f31043a commit 4021693
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/badge/Badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export default {
[`${prefixCls}-not-a-wrapper`]: !children.length,
})
const styleWithOffset = offset ? {
marginTop: offset[0],
marginLeft: offset[1],
marginLeft: typeof offset[0] === 'number' ? `${offset[0]}px` : offset[0],
marginTop: typeof offset[1] === 'number' ? `${offset[1]}px` : offset[1],
...numberStyle,
} : numberStyle
// <Badge status="success" />
Expand Down
2 changes: 1 addition & 1 deletion components/badge/index.en_US.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| -------- | ----------- | ---- | ------- |
| count | Number to show in badge | number\|string | |
| dot | Whether to display a red dot instead of `count` | boolean | `false` |
| offset | set offset of the badge dot, like [x, y] | [number, number] | - |
| offset | set offset of the badge dot, like [x, y] | [number\|string, number\|string] | - |
| overflowCount | Max count to show | number | 99 |
| showZero | Whether to show badge when `count` is zero | boolean | `false` |
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` |
Expand Down
2 changes: 1 addition & 1 deletion components/badge/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| --- | --- | --- | --- |
| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number\|string | |
| dot | 不展示数字,只有一个小红点 | boolean | false |
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number, number] | - |
| offset | 设置状态点的位置偏移,格式为 [x, y] | [number\|string, number\|string] | - |
| overflowCount | 展示封顶的数字值 | number | 99 |
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false |
| status | 设置 Badge 为状态点 | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' |
Expand Down

0 comments on commit 4021693

Please sign in to comment.