Removing duplicate back button on root level of new navigation (https://github.com/woocommerce/woocommerce-admin/pull/5915)

This commit is contained in:
Joel Thiessen 2021-01-04 09:00:42 -08:00 committed by GitHub
parent 71877be8dc
commit 750efaef0f
1 changed files with 7 additions and 3 deletions

View File

@ -114,6 +114,8 @@ const Container = ( { menuItems } ) => {
} ); } );
}; };
const isRootBackVisible = activeLevel === 'woocommerce' && rootBackUrl;
return ( return (
<div className="woocommerce-navigation"> <div className="woocommerce-navigation">
<Header /> <Header />
@ -129,7 +131,7 @@ const Container = ( { menuItems } ) => {
setActiveLevel( ...args ); setActiveLevel( ...args );
} } } }
> >
{ activeLevel === 'woocommerce' && rootBackUrl && ( { isRootBackVisible && (
<NavigationBackButton <NavigationBackButton
className="woocommerce-navigation__back-to-dashboard" className="woocommerce-navigation__back-to-dashboard"
href={ rootBackUrl } href={ rootBackUrl }
@ -152,8 +154,10 @@ const Container = ( { menuItems } ) => {
backButtonLabel={ backButtonLabel={
category.backButtonLabel || null category.backButtonLabel || null
} }
onBackButtonClick={ () => onBackButtonClick={
trackBackClick( category.id ) isRootBackVisible
? null
: () => trackBackClick( category.id )
} }
> >
{ !! primaryItems && ( { !! primaryItems && (