(entries: Navigation, context: Context = {})
| 40 | const t = useTranslations(); |
| 41 | |
| 42 | const mapNavigationEntries = (entries: Navigation, context: Context = {}) => { |
| 43 | const getFormattedMessage = (label: IntlMessageKeys, key: string) => |
| 44 | t.rich(label, context[key] || {}) as FormattedMessage; |
| 45 | |
| 46 | return Object.entries(entries).map( |
| 47 | ([key, { label, link, items, target }]): [ |
| 48 | string, |
| 49 | MappedNavigationEntry, |
| 50 | ] => [ |
| 51 | key, |
| 52 | { |
| 53 | target, |
| 54 | label: label ? getFormattedMessage(label, key) : '', |
| 55 | link: link ? replaceLinkWithContext(link, context[key]) : '', |
| 56 | items: items ? mapNavigationEntries(items, context) : [], |
| 57 | }, |
| 58 | ] |
| 59 | ); |
| 60 | }; |
| 61 | |
| 62 | const getSideNavigation = ( |
| 63 | keys: Array<NavigationKeys>, |
no test coverage detected