Skip to content

Commit

Permalink
Add back link to Design heading in site editor navigation to return t…
Browse files Browse the repository at this point in the history
…o Dashboard (#47950)
  • Loading branch information
glendaviesnz committed Feb 13, 2023
1 parent f580ad6 commit 79103f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,32 @@ import {
__experimentalHStack as HStack,
__experimentalVStack as VStack,
__experimentalNavigatorToParentButton as NavigatorToParentButton,
Button,
__experimentalNavigatorScreen as NavigatorScreen,
} from '@wordpress/components';
import { isRTL, __ } from '@wordpress/i18n';
import { chevronRight, chevronLeft } from '@wordpress/icons';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import { store as editSiteStore } from '../../store';
import { unlock } from '../../private-apis';

export default function SidebarNavigationScreen( {
path,
title,
actions,
content,
} ) {
const { dashboardLink } = useSelect( ( select ) => {
const { getSettings } = unlock( select( editSiteStore ) );
return {
dashboardLink: getSettings().__experimentalDashboardLink,
};
}, [] );

return (
<NavigatorScreen
className="edit-site-sidebar-navigation-screen"
Expand All @@ -34,7 +49,13 @@ export default function SidebarNavigationScreen( {
aria-label={ __( 'Back' ) }
/>
) : (
<div className="edit-site-sidebar-navigation-screen__icon-placeholder" />
<Button
className="edit-site-sidebar-navigation-screen__back"
icon={ isRTL() ? chevronRight : chevronLeft }
aria-label={ __( 'Navigate to the Dashboard' ) }
href={ dashboardLink || 'index.php' }
label={ __( 'Dashboard' ) }
/>
) }
<h2 className="edit-site-sidebar-navigation-screen__title">
{ title }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,3 @@
color: $white;
}
}

.edit-site-sidebar-navigation-screen__icon-placeholder {
width: $button-size;
}

1 comment on commit 79103f1

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 79103f1.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4167908939
📝 Reported issues:

Please sign in to comment.