Skip to content

Commit

Permalink
Add button to switch to edit mode and open global styles sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Mar 27, 2023
1 parent f29c9b9 commit 30670ce
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,40 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { brush } from '@wordpress/icons';
import { useDispatch } from '@wordpress/data';

/**
* Internal dependencies
*/
import SidebarNavigationScreen from '../sidebar-navigation-screen';
import StyleVariationsContainer from '../global-styles/style-variations-container';
import { unlock } from '../../private-apis';
import { store as editSiteStore } from '../../store';
import SidebarButton from '../sidebar-button';

export default function SidebarNavigationScreenGlobalStyles() {
const { openGeneralSidebar } = useDispatch( editSiteStore );
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
return (
<SidebarNavigationScreen
title={ __( 'Styles' ) }
description={ __(
'Choose a different style combination for the theme styles.'
) }
content={ <StyleVariationsContainer /> }
actions={
<SidebarButton
icon={ brush }
label={ __( 'Edit styles' ) }
onClick={ () => {
// switch to edit mode.
setCanvasMode( 'edit' );
// open global styles sidebar.
openGeneralSidebar( 'edit-site/global-styles' );
} }
/>
}
/>
);
}

0 comments on commit 30670ce

Please sign in to comment.