-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
content.js
55 lines (49 loc) · 1.68 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { __experimentalVStack as VStack } from '@wordpress/components';
import { BlockEditorProvider } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import StyleVariationsContainer from '../global-styles/style-variations-container';
import { unlock } from '../../lock-unlock';
import { store as editSiteStore } from '../../store';
import ColorVariations from '../global-styles/variations/variations-color';
import TypographyVariations from '../global-styles/variations/variations-typography';
const noop = () => {};
export default function SidebarNavigationScreenGlobalStylesContent() {
const { storedSettings } = useSelect( ( select ) => {
const { getSettings } = unlock( select( editSiteStore ) );
return {
storedSettings: getSettings(),
};
}, [] );
const gap = 3;
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
// loaded. This is necessary because the Iframe component waits until
// the block editor store's `__internalIsInitialized` is true before
// rendering the iframe. Without this, the iframe previews will not render
// in mobile viewport sizes, where the editor canvas is hidden.
return (
<BlockEditorProvider
settings={ storedSettings }
onChange={ noop }
onInput={ noop }
>
<VStack
spacing={ 10 }
className="edit-site-global-styles-variation-container"
>
<StyleVariationsContainer gap={ gap } />
<ColorVariations title={ __( 'Palettes' ) } gap={ gap } />
<TypographyVariations
title={ __( 'Typography' ) }
gap={ gap }
/>
</VStack>
</BlockEditorProvider>
);
}