File tree Expand file tree Collapse file tree 6 files changed +7
-15
lines changed Expand file tree Collapse file tree 6 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ exports[`test BlockHeader render should render BlockHeader success render 1`] =
7
7
<div >
8
8
<div
9
9
class = " dtc-block-header"
10
+ style = " margin-bottom: 16px;"
10
11
>
11
12
<div
12
13
class = " dtc-block-header__title dtc-block-header__title--middle dtc-block-header__title--background"
@@ -34,6 +35,7 @@ exports[`test BlockHeader render should render BlockHeader success render 1`] =
34
35
" container" : <div >
35
36
<div
36
37
class = " dtc-block-header"
38
+ style = " margin-bottom: 16px;"
37
39
>
38
40
<div
39
41
class = " dtc-block-header__title dtc-block-header__title--middle dtc-block-header__title--background"
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ const props2: IBlockHeaderProps = {
15
15
size : 'small' as SizeType ,
16
16
className : 'test__className' ,
17
17
style : { height : '100px' } ,
18
- hasBottom : true ,
19
18
} ;
20
19
const props3 : IBlockHeaderProps = {
21
20
title : 'hover' ,
@@ -124,14 +123,14 @@ describe('test BlockHeader render', () => {
124
123
} ) ;
125
124
126
125
test ( 'should render BlockHeader correct margin-bottom' , ( ) => {
127
- const { container : noStyle } = render ( < BlockHeader title = "分类级别" addonBefore = "" /> ) ;
128
- expect ( noStyle . querySelector ( '.dtc-block-header' ) ) . not . toHaveAttribute ( 'style' ) ;
126
+ const { container : haveStyle } = render ( < BlockHeader title = "分类级别" addonBefore = "" /> ) ;
127
+ expect ( haveStyle . querySelector ( '.dtc-block-header' ) ) . toHaveAttribute ( 'style' ) ;
129
128
const { container : defaultBottom } = render (
130
129
< BlockHeader title = "分类级别" addonBefore = "" />
131
130
) ;
132
131
expect ( defaultBottom . querySelector ( '.dtc-block-header' ) ) . toHaveStyle ( { marginBottom : 16 } ) ;
133
132
const { container : customizeBottom } = render (
134
- < BlockHeader title = "分类级别" addonBefore = "" hasBottom spaceBottom = { 10 } />
133
+ < BlockHeader title = "分类级别" addonBefore = "" spaceBottom = { 10 } />
135
134
) ;
136
135
expect ( customizeBottom . querySelector ( '.dtc-block-header' ) ) . toHaveStyle ( {
137
136
marginBottom : 10 ,
Original file line number Diff line number Diff line change @@ -6,11 +6,8 @@ export default () => {
6
6
return (
7
7
< >
8
8
< BlockHeader title = "分类标题" />
9
- < br />
10
9
< BlockHeader title = "分类标题" addonBefore = { '' } />
11
- < br />
12
10
< BlockHeader title = "分类标题" addonBefore = { < PieChartOutlined /> } />
13
- < br />
14
11
< BlockHeader title = "分类标题" addonBefore = { < PauseCircleOutlined /> } />
15
12
</ >
16
13
) ;
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ export default () => {
44
44
< BlockHeader
45
45
size = { size }
46
46
title = "分类标题"
47
- hasBottom
48
47
addonBefore = { < PieChartOutlined /> }
49
48
background = { showBackground }
50
49
tooltip = { tooltip ? '这里展示问号提示' : '' }
Original file line number Diff line number Diff line change 38
38
| background | 是否显示背景 | ` boolean ` | ` true ` |
39
39
| expand | 当前展开状态 | ` boolean ` | |
40
40
| defaultExpand | 是否默认展开内容 | ` boolean ` | ` true ` |
41
- | hasBottom | 是否有默认下边距 16px | ` boolean ` | ` false ` |
42
- | spaceBottom | 自定义下边距,优先级高于 hasBottom | ` number ` | ` 0 ` |
41
+ | spaceBottom | 自定义下边距,优先级高于 hasBottom | ` number ` | ` 16 ` |
43
42
| children | 展开/收起的内容 | ` React.ReactNode ` | - |
44
43
| onExpand | 展开/收起时的回调 | ` (expand: boolean) => void ` | - |
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ export interface IBlockHeaderProps {
30
30
* 默认 中标题
31
31
*/
32
32
size ?: SizeType ;
33
- /** 是否展示 Bottom,默认 false,Bottom 值 16px */
34
- hasBottom ?: boolean ;
35
33
/** 自定义 Bottom 值 */
36
34
spaceBottom ?: number ;
37
35
/** 标题一行的样式类名 */
@@ -59,8 +57,7 @@ const BlockHeader: React.FC<IBlockHeaderProps> = function (props) {
59
57
description = '' ,
60
58
tooltip,
61
59
size = 'middle' ,
62
- hasBottom = false ,
63
- spaceBottom = 0 ,
60
+ spaceBottom = 16 ,
64
61
className = '' ,
65
62
style = { } ,
66
63
background = true ,
@@ -79,7 +76,6 @@ const BlockHeader: React.FC<IBlockHeaderProps> = function (props) {
79
76
const tooltipProps = toTooltipProps ( tooltip ) ;
80
77
81
78
let bottomStyle ;
82
- if ( hasBottom ) bottomStyle = { marginBottom : 16 } ;
83
79
if ( spaceBottom ) bottomStyle = { marginBottom : spaceBottom } ;
84
80
85
81
const handleExpand = ( expand : boolean ) => {
You can’t perform that action at this time.
0 commit comments