Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight "Site" in the navigation panel #36762

Merged
merged 1 commit into from
Nov 24, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -46,7 +46,7 @@ export default function NavigationSidebar( {
<NavigationPanel
isOpen={ isNavigationOpen }
setIsOpen={ setIsNavigationOpen }
activeTemplateType={ activeTemplateType }
activeItem={ activeTemplateType }
/>
<NavigationPanelPreviewSlot />
</>
Expand Down
Expand Up @@ -26,7 +26,13 @@ import { addQueryArgs } from '@wordpress/url';
*/
import MainDashboardButton from '../../main-dashboard-button';

const NavigationPanel = ( { isOpen, setIsOpen, activeTemplateType } ) => {
const SITE_EDITOR_KEY = 'site-editor';

const NavigationPanel = ( {
isOpen,
setIsOpen,
activeItem = SITE_EDITOR_KEY,
} ) => {
const siteTitle = useSelect( ( select ) => {
const { getEntityRecord } = select( coreDataStore );

Expand All @@ -43,7 +49,7 @@ const NavigationPanel = ( { isOpen, setIsOpen, activeTemplateType } ) => {
if ( isOpen ) {
panelRef.current.focus();
}
}, [ activeTemplateType, isOpen ] );
}, [ activeItem, isOpen ] );

const closeOnEscape = ( event ) => {
if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
Expand All @@ -69,7 +75,7 @@ const NavigationPanel = ( { isOpen, setIsOpen, activeTemplateType } ) => {
</div>
</div>
<div className="edit-site-navigation-panel__scroll-container">
<Navigation activeItem={ activeTemplateType }>
<Navigation activeItem={ activeItem }>
<MainDashboardButton.Slot>
<NavigationBackButton
backButtonLabel={ __( 'Dashboard' ) }
Expand All @@ -82,6 +88,7 @@ const NavigationPanel = ( { isOpen, setIsOpen, activeTemplateType } ) => {
<NavigationGroup title={ __( 'Editor' ) }>
<NavigationItem
title={ __( 'Site' ) }
item={ SITE_EDITOR_KEY }
href={ addQueryArgs( window.location.href, {
postId: undefined,
postType: undefined,
Expand Down