Skip to content

Commit

Permalink
Use the flag in the client to hide the GS UI
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Oct 7, 2021
1 parent 4850fab commit 8404a6d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/edit-site/src/components/global-styles/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,9 @@ export function getSupportedGlobalStylesPanels( name ) {

return supportKeys;
}

export function useGlobalStylesIsEnabled() {
return useSelect( ( select ) => {
return select( editSiteStore ).getSettings().isGlobalStylesUIEnabled;
}, [] );
}
7 changes: 6 additions & 1 deletion packages/edit-site/src/components/global-styles/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export { default as GlobalStylesUI } from './ui';
export { useGlobalStylesReset, useStyle, useSetting } from './hooks';
export {
useGlobalStylesIsEnabled,
useGlobalStylesReset,
useStyle,
useSetting,
} from './hooks';
export { useGlobalStylesOutput } from './use-global-styles-output';
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ import { styles } from '@wordpress/icons';
* Internal dependencies
*/
import DefaultSidebar from './default-sidebar';
import { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';
import {
useGlobalStylesIsEnabled,
GlobalStylesUI,
useGlobalStylesReset,
} from '../global-styles';

export default function GlobalStylesSidebar() {
const [ canRestart, onReset ] = useGlobalStylesReset();
if ( ! useGlobalStylesIsEnabled() ) {
return null;
}

return (
<DefaultSidebar
Expand Down

0 comments on commit 8404a6d

Please sign in to comment.