How to use the @wordpress/compose.useViewportMatch function in @wordpress/compose

To help you get started, we’ve selected a few @wordpress/compose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / packages / block-editor / src / components / tool-selector / index.js View on Github external
function ToolSelector() {
	const isNavigationTool = useSelect( ( select ) => select( 'core/block-editor' ).isNavigationMode(), [] );
	const { setNavigationMode } = useDispatch( 'core/block-editor' );
	const isMediumViewport = useViewportMatch( 'medium' );
	if ( ! isMediumViewport ) {
		return null;
	}

	const onSwitchMode = ( mode ) => {
		setNavigationMode( mode === 'edit' ? false : true );
	};

	return (
		 (
github WordPress / gutenberg / packages / edit-post / src / components / layout / index.js View on Github external
function Layout() {
	const isMobileViewport = useViewportMatch( 'small', '<' );
	const { closePublishSidebar, togglePublishSidebar } = useDispatch( 'core/edit-post' );
	const {
		mode,
		isRichEditingEnabled,
		editorSidebarOpened,
		pluginSidebarOpened,
		publishSidebarOpened,
		hasActiveMetaboxes,
		isSaving,
		hasFixedToolbar,
		previousShortcut,
		nextShortcut,
	} = useSelect( ( select ) => {
		return ( {
			hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' ),
			editorSidebarOpened: select( 'core/edit-post' ).isEditorSidebarOpened(),