Skip to content

Commit

Permalink
Show other sidebar items on Styles sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Sep 25, 2024
1 parent 50ecb63 commit 9309e34
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { __ } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { useViewportMatch } from '@wordpress/compose';
import { useCallback } from '@wordpress/element';
import { store as preferencesStore } from '@wordpress/preferences';

Expand All @@ -18,6 +17,7 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
import StyleBook from '../style-book';
import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
import { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';

export function SidebarNavigationItemGlobalStyles( props ) {
const { openGeneralSidebar } = useDispatch( editSiteStore );
Expand Down Expand Up @@ -56,7 +56,6 @@ export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
const { revisions, isLoading: isLoadingRevisions } =
useGlobalStylesRevisions();
const { openGeneralSidebar } = useDispatch( editSiteStore );
const isMobileViewport = useViewportMatch( 'medium', '<' );
const { setCanvasMode, setEditorCanvasContainerView } = unlock(
useDispatch( editSiteStore )
);
Expand Down Expand Up @@ -107,6 +106,7 @@ export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
'Choose a different style combination for the theme styles.'
) }
backPath={ backPath }
content={ <MainSidebarNavigationContent isStylesSelected /> }
footer={
shouldShowGlobalStylesFooter && (
<SidebarNavigationScreenDetailsFooter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,54 @@ import {
PATTERN_TYPES,
} from '../../utils/constants';

export function MainSidebarNavigationContent( { isStylesSelected } ) {
return (
<ItemGroup>
<SidebarNavigationItem
uid="navigation-navigation-item"
params={ { postType: NAVIGATION_POST_TYPE } }
withChevron
icon={ navigation }
>
{ __( 'Navigation' ) }
</SidebarNavigationItem>
<SidebarNavigationItemGlobalStyles
uid="styles-navigation-item"
className="is-selected"
withChevron
icon={ styles }
aria-current={ isStylesSelected }
>
{ __( 'Styles' ) }
</SidebarNavigationItemGlobalStyles>
<SidebarNavigationItem
uid="page-navigation-item"
params={ { postType: 'page' } }
withChevron
icon={ page }
>
{ __( 'Pages' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="template-navigation-item"
params={ { postType: TEMPLATE_POST_TYPE } }
withChevron
icon={ layout }
>
{ __( 'Templates' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="patterns-navigation-item"
params={ { postType: PATTERN_TYPES.user } }
withChevron
icon={ symbol }
>
{ __( 'Patterns' ) }
</SidebarNavigationItem>
</ItemGroup>
);
}

export default function SidebarNavigationScreenMain() {
const { setEditorCanvasContainerView } = unlock(
useDispatch( editSiteStore )
Expand All @@ -38,51 +86,7 @@ export default function SidebarNavigationScreenMain() {
description={ __(
'Customize the appearance of your website using the block editor.'
) }
content={
<>
<ItemGroup>
<SidebarNavigationItem
uid="navigation-navigation-item"
params={ { postType: NAVIGATION_POST_TYPE } }
withChevron
icon={ navigation }
>
{ __( 'Navigation' ) }
</SidebarNavigationItem>
<SidebarNavigationItemGlobalStyles
uid="styles-navigation-item"
withChevron
icon={ styles }
>
{ __( 'Styles' ) }
</SidebarNavigationItemGlobalStyles>
<SidebarNavigationItem
uid="page-navigation-item"
params={ { postType: 'page' } }
withChevron
icon={ page }
>
{ __( 'Pages' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="template-navigation-item"
params={ { postType: TEMPLATE_POST_TYPE } }
withChevron
icon={ layout }
>
{ __( 'Templates' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="patterns-navigation-item"
params={ { postType: PATTERN_TYPES.user } }
withChevron
icon={ symbol }
>
{ __( 'Patterns' ) }
</SidebarNavigationItem>
</ItemGroup>
</>
}
content={ <MainSidebarNavigationContent /> }
/>
);
}

0 comments on commit 9309e34

Please sign in to comment.