Skip to content

Commit

Permalink
Site Editor Sidebar: remove hasGlobalStyleVariations condition for …
Browse files Browse the repository at this point in the history
…the Styles nav item (WordPress#67545)

Co-authored-by: ramonjd <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
  • Loading branch information
3 people authored and im3dabasia committed Dec 4, 2024
1 parent 5e7385d commit 83f25b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { useDispatch } from '@wordpress/data';
import { useCallback } from '@wordpress/element';
import { store as preferencesStore } from '@wordpress/preferences';
import { privateApis as routerPrivateApis } from '@wordpress/router';
Expand All @@ -24,27 +23,9 @@ const { useLocation, useHistory } = unlock( routerPrivateApis );

export function SidebarNavigationItemGlobalStyles( props ) {
const { name } = useLocation();
const hasGlobalStyleVariations = useSelect(
( select ) =>
!! select(
coreStore
).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,
[]
);
if ( hasGlobalStyleVariations ) {
return (
<SidebarNavigationItem
{ ...props }
to="/styles"
uid="global-styles-navigation-item"
aria-current={ name === 'styles' }
/>
);
}
return (
<SidebarNavigationItem
{ ...props }
to="/styles"
aria-current={ name === 'styles' }
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export function MainSidebarNavigationContent() {
{ __( 'Navigation' ) }
</SidebarNavigationItem>
<SidebarNavigationItemGlobalStyles
uid="styles-navigation-item"
to="/styles"
uid="global-styles-navigation-item"
icon={ styles }
>
{ __( 'Styles' ) }
Expand Down

0 comments on commit 83f25b1

Please sign in to comment.