@@ -5,6 +5,10 @@ import KeyCode from '@rc-component/util/lib/KeyCode';
55import type { Status , StepItem , StepsProps } from './Steps' ;
66import Rail from './Rail' ;
77
8+ function hasContent < T > ( value : T ) {
9+ return value !== undefined && value !== null ;
10+ }
11+
812export interface StepProps {
913 // style
1014 prefixCls ?: string ;
@@ -18,12 +22,6 @@ export interface StepProps {
1822 index : number ;
1923 last : boolean ;
2024
21- // stepIndex?: number;
22- // stepNumber?: number;
23- // title?: React.ReactNode;
24- // subTitle?: React.ReactNode;
25- // description?: React.ReactNode;
26-
2725 // render
2826 iconRender ?: StepsProps [ 'iconRender' ] ;
2927 icon ?: React . ReactNode ;
@@ -115,29 +113,37 @@ export default function Step(props: StepProps) {
115113 // ========================= Render =========================
116114 const mergedStatus = status || 'wait' ;
117115
116+ const hasTitle = hasContent ( title ) ;
117+ const hasSubTitle = hasContent ( subTitle ) ;
118+
118119 const classString = cls (
119120 itemCls ,
120121 `${ itemCls } -${ mergedStatus } ` ,
121122 {
122123 [ `${ itemCls } -custom` ] : icon ,
123124 [ `${ itemCls } -active` ] : active ,
124125 [ `${ itemCls } -disabled` ] : disabled === true ,
126+ [ `${ itemCls } -empty-header` ] : ! hasTitle && ! hasSubTitle ,
125127 } ,
126128 className ,
127129 classNames . item ,
128130 ) ;
129131
132+ // !hasContent(title) && !hasContent(subTitle) && `${itemCls}-header-empty`
133+
130134 const wrapperNode = (
131135 < div className = { cls ( `${ itemCls } -wrapper` , classNames . itemWrapper ) } style = { styles . itemWrapper } >
132136 < div className = { cls ( `${ itemCls } -icon` , classNames . itemIcon ) } style = { styles . itemIcon } >
133137 { iconRender ?.( renderInfo ) }
134138 </ div >
135139 < div className = { cls ( `${ itemCls } -section` , classNames . itemSection ) } style = { styles . itemSection } >
136140 < div className = { cls ( `${ itemCls } -header` , classNames . itemHeader ) } style = { styles . itemHeader } >
137- < div className = { cls ( `${ itemCls } -title` , classNames . itemTitle ) } style = { styles . itemTitle } >
138- { title }
139- </ div >
140- { subTitle && (
141+ { hasTitle && (
142+ < div className = { cls ( `${ itemCls } -title` , classNames . itemTitle ) } style = { styles . itemTitle } >
143+ { title }
144+ </ div >
145+ ) }
146+ { hasSubTitle && (
141147 < div
142148 title = { typeof subTitle === 'string' ? subTitle : undefined }
143149 className = { cls ( `${ itemCls } -subtitle` , classNames . itemSubtitle ) }
@@ -151,7 +157,7 @@ export default function Step(props: StepProps) {
151157 < Rail prefixCls = { itemCls } classNames = { classNames } styles = { styles } status = { nextStatus } />
152158 ) }
153159 </ div >
154- { mergedContent && (
160+ { hasContent ( mergedContent ) && (
155161 < div
156162 className = { cls ( `${ itemCls } -content` , classNames . itemContent ) }
157163 style = { styles . itemContent }
0 commit comments