File size: 956 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import { sortByMenuOrder } from '../utils';
import Bundle from './bundle';
import type { MenuItem } from 'calypso/data/jetpack/use-jetpack-masterbar-data-query';
import type { FC } from 'react';
interface BundlesSectionProps {
bundles: MenuItem | null;
}
const BundlesSection: FC< BundlesSectionProps > = ( { bundles } ) => {
if ( ! bundles || Array( bundles.items ).length < 1 ) {
return null;
}
return (
<div className="header__submenu-bundles-section">
<div className="header__submenu-bundles-wrapper">
<p className="header__submenu-category-title">{ bundles.label }</p>
<ul className="header__submenu-bundles-list">
{ bundles &&
Array.from( Object.values( bundles.items ) )
.sort( sortByMenuOrder )
.map( ( { id, label, href } ) => (
<Bundle key={ `bundles-${ href }-${ label }` } bundle={ { id, label, href } } />
) ) }
</ul>
</div>
</div>
);
};
export default BundlesSection;
|