Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/edit-site/src/components/sidebar-navigation-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ import { SidebarNavigationContext } from '../sidebar';
const { useHistory, useLink, useLocation } = unlock( routerPrivateApis );

export default function SidebarNavigationItem( {
isHidden = false,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could find a better name, Claude tried as well 😄 I'm open for suggestions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a more suitable name either 😄

...props
} ) {
if ( isHidden ) {
return null;
}

return <SidebarNavigationItemContent { ...props } />;
}

function SidebarNavigationItemContent( {
className,
icon,
withChevron = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,52 +23,46 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
export function MainSidebarNavigationContent( { isBlockBasedTheme = true } ) {
return (
<ItemGroup className="edit-site-sidebar-navigation-screen-main">
{ isBlockBasedTheme && (
<>
<SidebarNavigationItem
to="/identity"
uid="identity-navigation-item"
icon={ siteLogo }
activeOnRouteName="identity"
>
{ _x( 'Identity', 'site identity' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
to="/styles"
uid="global-styles-navigation-item"
icon={ styles }
activeOnRouteName="styles"
>
{ __( 'Styles' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="page-navigation-item"
to="/page"
withChevron
icon={ page }
>
{ __( 'Pages' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="navigation-navigation-item"
to="/navigation"
withChevron
icon={ navigation }
>
{ __( 'Navigation' ) }
</SidebarNavigationItem>
</>
) }
{ ! isBlockBasedTheme && (
<SidebarNavigationItem
uid="stylebook-navigation-item"
to="/stylebook"
withChevron
icon={ styles }
>
{ __( 'Styles' ) }
</SidebarNavigationItem>
) }
<SidebarNavigationItem
to="/identity"
uid="identity-navigation-item"
icon={ siteLogo }
activeOnRouteName="identity"
isHidden={ ! isBlockBasedTheme }
>
{ _x( 'Identity', 'site identity' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
to={ isBlockBasedTheme ? '/styles' : '/stylebook' }
uid={
isBlockBasedTheme
? 'global-styles-navigation-item'
: 'stylebook-navigation-item'
}
icon={ styles }
activeOnRouteName={ isBlockBasedTheme ? 'styles' : undefined }
withChevron={ ! isBlockBasedTheme }
>
{ __( 'Styles' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="page-navigation-item"
to="/page"
withChevron
icon={ page }
isHidden={ ! isBlockBasedTheme }
>
{ __( 'Pages' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="navigation-navigation-item"
to="/navigation"
withChevron
icon={ navigation }
isHidden={ ! isBlockBasedTheme }
>
{ __( 'Navigation' ) }
</SidebarNavigationItem>
<SidebarNavigationItem
uid="patterns-navigation-item"
to="/pattern"
Expand All @@ -77,16 +71,15 @@ export function MainSidebarNavigationContent( { isBlockBasedTheme = true } ) {
>
{ __( 'Patterns' ) }
</SidebarNavigationItem>
{ isBlockBasedTheme && (
<SidebarNavigationItem
uid="template-navigation-item"
to="/template"
withChevron
icon={ layout }
>
{ __( 'Templates' ) }
</SidebarNavigationItem>
) }
<SidebarNavigationItem
uid="template-navigation-item"
to="/template"
withChevron
icon={ layout }
isHidden={ ! isBlockBasedTheme }
>
{ __( 'Templates' ) }
</SidebarNavigationItem>
</ItemGroup>
);
}
Expand Down
Loading