@@ -4,8 +4,6 @@ import { MenuItem } from './main-menu';
44import { menuProps , RecursiveMenuProps } from './recursive-props' ;
55import { getHrefByType , getTargetByType , handleUnsavedChanges } from './helpers' ;
66
7- console . log ( 'top level' ) ;
8-
97const TopLevel = ( {
108 level,
119 id,
@@ -16,36 +14,51 @@ const TopLevel = ({
1614 items,
1715 type,
1816} ) => (
19- < li className = { `${ active ? 'active' : '' } menu-list-group-item secondary-nav-item-pf` } data-target = { `#menu-${ id } ` } >
20- < a
21- onClick = { ( event ) => {
22- if ( handleUnsavedChanges ( type ) === false ) {
23- event . preventDefault ( ) ;
24- }
25- return false ;
26- } }
27- href = { getHrefByType ( type , href , id ) }
28- target = { getTargetByType ( type ) }
29- className = "top-level"
30- >
31- < span className = { iconClass } />
32- < span className = "list-group-item-value" > { title } </ span >
33- </ a >
34- { items . length > 0 && (
35- < React . Fragment >
36- < div className = "nav-pf-secondary-nav" id = { `menu-${ id } ` } >
37- < div className = "nav-item-pf-header" >
38- < a className = "secondary-collapse-toggle-pf top-level" data-toggle = "collapse-secondary-nav" >
39- < span > { title } </ span >
40- </ a >
17+ items . length > 0 ? (
18+ < li className = { `${ active ? 'active' : '' } menu-list-group-item secondary-nav-item-pf` } data-target = { `#menu-${ id } ` } id = { `menu_item_${ id } ` } >
19+ < a
20+ onClick = { ( event ) => {
21+ if ( handleUnsavedChanges ( type ) === false ) {
22+ event . preventDefault ( ) ;
23+ }
24+ return false ;
25+ } }
26+ href = { getHrefByType ( type , href , id ) }
27+ target = { getTargetByType ( type ) }
28+ className = "top-level"
29+ >
30+ < span className = { iconClass } />
31+ < span className = "list-group-item-value" > { title } </ span >
32+ </ a >
33+ < React . Fragment >
34+ < div className = "nav-pf-secondary-nav" id = { `menu-${ id } ` } >
35+ < div className = "nav-item-pf-header" >
36+ < a className = "secondary-collapse-toggle-pf top-level" data-toggle = "collapse-secondary-nav" >
37+ < span > { title } </ span >
38+ </ a >
39+ </ div >
40+ < ul className = "list-group" >
41+ { items . map ( props => < MenuItem key = { props . id } level = { level + 1 } { ...props } /> ) }
42+ </ ul >
4143 </ div >
42- < ul className = "list-group" >
43- { items . map ( props => < MenuItem key = { props . id } level = { level + 1 } { ...props } /> ) }
44- </ ul >
45- </ div >
46- </ React . Fragment >
47- ) }
48- </ li >
44+ </ React . Fragment >
45+ </ li >
46+ ) : (
47+ < li className = "menu-list-group-item" id = { `menu_item_${ id } ` } >
48+ < a
49+ onClick = { ( event ) => {
50+ if ( handleUnsavedChanges ( type ) === false ) {
51+ event . preventDefault ( ) ;
52+ }
53+ return false ;
54+ } }
55+ href = { getHrefByType ( type , href , id ) }
56+ >
57+ < span className = { iconClass } />
58+ < span className = "list-group-item-value" > { title } </ span >
59+ </ a >
60+ </ li >
61+ )
4962) ;
5063
5164TopLevel . propTypes = {
0 commit comments