File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -20,22 +20,28 @@ export interface MenuGroupProps extends Omit<React.HTMLProps<HTMLElement>, 'labe
2020const MenuGroupBase : React . FunctionComponent < MenuGroupProps > = ( {
2121 children,
2222 className = '' ,
23- label = '' ,
23+ label,
2424 titleId,
2525 innerRef,
2626 labelHeadingLevel : HeadingLevel = 'h1' ,
2727 ...props
2828} : MenuGroupProps ) => {
2929 const Wrapper = typeof label === 'function' ? label : HeadingLevel ;
30+ const hasLabel = label !== undefined && label !== null && label !== '' ;
31+
3032 return (
3133 < section { ...props } className = { css ( styles . menuGroup , className ) } ref = { innerRef } >
3234 < >
33- { [ 'function' , 'string' ] . includes ( typeof label ) ? (
34- < Wrapper className = { css ( styles . menuGroupTitle ) } id = { titleId } >
35- { label }
36- </ Wrapper >
37- ) : (
38- label
35+ { hasLabel && (
36+ < >
37+ { [ 'function' , 'string' ] . includes ( typeof label ) ? (
38+ < Wrapper className = { css ( styles . menuGroupTitle ) } id = { titleId } >
39+ { label }
40+ </ Wrapper >
41+ ) : (
42+ label
43+ ) }
44+ </ >
3945 ) }
4046 { children }
4147 </ >
You can’t perform that action at this time.
0 commit comments