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 (#67545)

Co-authored-by: ramonjd <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent f32a49e commit fa636dc
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

1 comment on commit fa636dc

@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 fa636dc.
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/12151911390
📝 Reported issues:

Please sign in to comment.