@@ -26,16 +26,24 @@ export namespace MegaMenuProps {
2626 } ;
2727
2828 export type Category = {
29- categoryMainLink : {
30- text : ReactNode ;
31- linkProps : RegisteredLinkProps ;
32- } ;
3329 links : {
3430 text : ReactNode ;
3531 linkProps : RegisteredLinkProps ;
3632 isActive ?: boolean ;
3733 } [ ] ;
38- } ;
34+ } & (
35+ | {
36+ categoryMainLink : {
37+ text : ReactNode ;
38+ linkProps : RegisteredLinkProps ;
39+ } ;
40+ categoryMainText ?: never ;
41+ }
42+ | {
43+ categoryMainText : ReactNode ;
44+ categoryMainLink ?: never ;
45+ }
46+ ) ;
3947}
4048
4149export const MegaMenu = memo (
@@ -101,30 +109,42 @@ export const MegaMenu = memo(
101109 </ div >
102110 </ div >
103111 ) }
104- { categories . map ( ( { categoryMainLink, links } , i ) => (
112+ { categories . map ( ( { categoryMainLink, categoryMainText , links } , i ) => (
105113 < div className = { fr . cx ( "fr-col-12" , "fr-col-lg-3" ) } key = { i } >
106- < h5
107- className = { cx (
108- fr . cx ( "fr-mega-menu__category" ) ,
109- classes . category
110- ) }
111- >
112- < Link
113- { ...categoryMainLink . linkProps }
114- id = {
115- categoryMainLink . linkProps . id ??
116- `${ id } -category-link${ generateValidHtmlId ( {
117- "text" : categoryMainLink . text
118- } ) } -${ i } `
119- }
114+ { categoryMainLink !== undefined && (
115+ < h5
120116 className = { cx (
121- fr . cx ( "fr-nav__link " ) ,
122- categoryMainLink . linkProps . className
117+ fr . cx ( "fr-mega-menu__category " ) ,
118+ classes . category
123119 ) }
124120 >
125- { categoryMainLink . text }
126- </ Link >
127- </ h5 >
121+ < Link
122+ { ...categoryMainLink . linkProps }
123+ id = {
124+ categoryMainLink . linkProps . id ??
125+ `${ id } -category-link${ generateValidHtmlId ( {
126+ "text" : categoryMainLink . text
127+ } ) } -${ i } `
128+ }
129+ className = { cx (
130+ fr . cx ( "fr-nav__link" ) ,
131+ categoryMainLink . linkProps . className
132+ ) }
133+ >
134+ { categoryMainLink . text }
135+ </ Link >
136+ </ h5 >
137+ ) }
138+ { categoryMainText !== undefined && (
139+ < h5
140+ className = { cx (
141+ fr . cx ( "fr-mega-menu__category" , "fr-nav__link" ) ,
142+ classes . category
143+ ) }
144+ >
145+ { categoryMainText }
146+ </ h5 >
147+ ) }
128148 < ul className = { cx ( fr . cx ( "fr-mega-menu__list" ) , classes . list ) } >
129149 { links . map ( ( { linkProps, text, isActive } , j ) => (
130150 < li key = { j } >
0 commit comments