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 authored and ntsekouras committed Feb 14, 2023
1 parent 0210b5b commit 0342acd
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,10 +5,18 @@ import {
__experimentalHStack as HStack,
__experimentalVStack as VStack,
__experimentalNavigatorToParentButton as NavigatorToParentButton,
Button,
__experimentalNavigatorScreen as NavigatorScreen,
} from '@wordpress/components';
import { isRTL, __, sprintf } 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,
Expand All @@ -17,6 +25,13 @@ export default function SidebarNavigationScreen( {
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 @@ -39,7 +54,13 @@ export default function SidebarNavigationScreen( {
) }
/>
) : (
<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 @@ -36,7 +36,3 @@
color: $white;
}
}

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

0 comments on commit 0342acd

Please sign in to comment.