SubMenu.utils.ts 393 B

12345678910111213
  1. import type { ProductMenuGroup, SubMenuSection } from './ProductMenu.types'
  2. export function convertSectionsToProductMenu(sections: SubMenuSection[]): ProductMenuGroup[] {
  3. return sections.map((section) => ({
  4. key: section.key,
  5. title: section.heading,
  6. items: section.links.map((link) => ({
  7. key: link.key,
  8. name: link.label,
  9. url: link.href ?? '#',
  10. })),
  11. }))
  12. }