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