The Node.js® Website
at main 902 B view raw
1import type { RichTranslationValues } from 'next-intl'; 2import type { FC } from 'react'; 3 4import ProgressionSidebar from '@/components/Common/ProgressionSidebar'; 5import { useSiteNavigation } from '@/hooks/server'; 6import type { NavigationKeys } from '@/types'; 7 8type WithProgressionSidebarProps = { 9 navKey: NavigationKeys; 10 context?: Record<string, RichTranslationValues>; 11}; 12 13const WithProgressionSidebar: FC<WithProgressionSidebarProps> = ({ 14 navKey, 15 context, 16}) => { 17 const { getSideNavigation } = useSiteNavigation(); 18 19 const [[, sidebarNavigation]] = getSideNavigation([navKey], context); 20 21 const mappedProgressionSidebarItems = sidebarNavigation.items.map( 22 ([, { label, items }]) => ({ 23 groupName: label, 24 items: items.map(([, item]) => item), 25 }) 26 ); 27 28 return <ProgressionSidebar groups={mappedProgressionSidebarItems} />; 29}; 30 31export default WithProgressionSidebar;