diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js index 933ef256cf0459..b46ad4d285a08b 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js @@ -4,7 +4,6 @@ import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, - __experimentalHeading as Heading, } from '@wordpress/components'; import { useViewportMatch } from '@wordpress/compose'; import { getTemplatePartIcon } from '@wordpress/editor'; @@ -31,16 +30,34 @@ import usePatternCategories from './use-pattern-categories'; import useTemplatePartAreas from './use-template-part-areas'; import { store as editSiteStore } from '../../store'; -function TemplatePartGroup( { areas, currentArea, currentType } ) { +function CategoriesGroup( { + templatePartAreas, + patternCategories, + currentCategory, + currentType, +} ) { + const [ allPatterns, ...otherPatterns ] = patternCategories; + return ( - <> -
- { __( 'Template parts' ) } -
- + + { allPatterns && ( + ) } + templateParts?.length || 0 ) @@ -50,56 +67,42 @@ function TemplatePartGroup( { areas, currentArea, currentType } ) { id={ 'all-parts' } type={ TEMPLATE_PART_POST_TYPE } isActive={ - currentArea === 'all-parts' && + currentCategory === 'all-parts' && currentType === TEMPLATE_PART_POST_TYPE } /> - { Object.entries( areas ).map( - ( [ area, { label, templateParts } ] ) => ( - - ) - ) } - - - ); -} - -function PatternCategoriesGroup( { - categories, - currentCategory, - currentType, -} ) { - return ( - <> - - { categories.map( ( category ) => ( + { Object.entries( templatePartAreas ).map( + ( [ area, { label, templateParts } ] ) => ( - ) ) } - - + ) + ) } + { otherPatterns.map( ( category ) => ( + + ) ) } + ); } @@ -162,20 +165,12 @@ export default function SidebarNavigationScreenPatterns() { ) } - { hasPatterns && ( - - ) } - { hasTemplateParts && ( - - ) } + ) }