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`] =
77 <div >
88 <div
99 class = " dtc-block-header"
10+ style = " margin-bottom: 16px;"
1011 >
1112 <div
1213 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`] =
3435 " container" : <div >
3536 <div
3637 class = " dtc-block-header"
38+ style = " margin-bottom: 16px;"
3739 >
3840 <div
3941 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 = {
1515 size : 'small' as SizeType ,
1616 className : 'test__className' ,
1717 style : { height : '100px' } ,
18- hasBottom : true ,
1918} ;
2019const props3 : IBlockHeaderProps = {
2120 title : 'hover' ,
@@ -124,14 +123,14 @@ describe('test BlockHeader render', () => {
124123 } ) ;
125124
126125 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' ) ;
129128 const { container : defaultBottom } = render (
130129 < BlockHeader title = "分类级别" addonBefore = "" />
131130 ) ;
132131 expect ( defaultBottom . querySelector ( '.dtc-block-header' ) ) . toHaveStyle ( { marginBottom : 16 } ) ;
133132 const { container : customizeBottom } = render (
134- < BlockHeader title = "分类级别" addonBefore = "" hasBottom spaceBottom = { 10 } />
133+ < BlockHeader title = "分类级别" addonBefore = "" spaceBottom = { 10 } />
135134 ) ;
136135 expect ( customizeBottom . querySelector ( '.dtc-block-header' ) ) . toHaveStyle ( {
137136 marginBottom : 10 ,
Original file line number Diff line number Diff line change @@ -6,11 +6,8 @@ export default () => {
66 return (
77 < >
88 < BlockHeader title = "分类标题" />
9- < br />
109 < BlockHeader title = "分类标题" addonBefore = { '' } />
11- < br />
1210 < BlockHeader title = "分类标题" addonBefore = { < PieChartOutlined /> } />
13- < br />
1411 < BlockHeader title = "分类标题" addonBefore = { < PauseCircleOutlined /> } />
1512 </ >
1613 ) ;
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ export default () => {
4444 < BlockHeader
4545 size = { size }
4646 title = "分类标题"
47- hasBottom
4847 addonBefore = { < PieChartOutlined /> }
4948 background = { showBackground }
5049 tooltip = { tooltip ? '这里展示问号提示' : '' }
Original file line number Diff line number Diff line change 3838| background | 是否显示背景 | ` boolean ` | ` true ` |
3939| expand | 当前展开状态 | ` boolean ` | |
4040| defaultExpand | 是否默认展开内容 | ` boolean ` | ` true ` |
41- | hasBottom | 是否有默认下边距 16px | ` boolean ` | ` false ` |
42- | spaceBottom | 自定义下边距,优先级高于 hasBottom | ` number ` | ` 0 ` |
41+ | spaceBottom | 自定义下边距,优先级高于 hasBottom | ` number ` | ` 16 ` |
4342| children | 展开/收起的内容 | ` React.ReactNode ` | - |
4443| onExpand | 展开/收起时的回调 | ` (expand: boolean) => void ` | - |
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ export interface IBlockHeaderProps {
3030 * 默认 中标题
3131 */
3232 size ?: SizeType ;
33- /** 是否展示 Bottom,默认 false,Bottom 值 16px */
34- hasBottom ?: boolean ;
3533 /** 自定义 Bottom 值 */
3634 spaceBottom ?: number ;
3735 /** 标题一行的样式类名 */
@@ -59,8 +57,7 @@ const BlockHeader: React.FC<IBlockHeaderProps> = function (props) {
5957 description = '' ,
6058 tooltip,
6159 size = 'middle' ,
62- hasBottom = false ,
63- spaceBottom = 0 ,
60+ spaceBottom = 16 ,
6461 className = '' ,
6562 style = { } ,
6663 background = true ,
@@ -79,7 +76,6 @@ const BlockHeader: React.FC<IBlockHeaderProps> = function (props) {
7976 const tooltipProps = toTooltipProps ( tooltip ) ;
8077
8178 let bottomStyle ;
82- if ( hasBottom ) bottomStyle = { marginBottom : 16 } ;
8379 if ( spaceBottom ) bottomStyle = { marginBottom : spaceBottom } ;
8480
8581 const handleExpand = ( expand : boolean ) => {
You can’t perform that action at this time.
0 commit comments