How to use the @wordpress/viewport.ifViewportMatches function in @wordpress/viewport

To help you get started, we’ve selected a few @wordpress/viewport 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 / edit-post / src / components / options-modal / options.js View on Github external
}
}

export const EnablePublishSidebarOption = compose(
	withSelect( ( select ) => ( {
		isChecked: select( 'core/editor' ).isPublishSidebarEnabled(),
	} ) ),
	withDispatch( ( dispatch ) => {
		const { enablePublishSidebar, disablePublishSidebar } = dispatch( 'core/editor' );
		return {
			onChange: ( isEnabled ) => ( isEnabled ? enablePublishSidebar() : disablePublishSidebar() ),
		};
	} ),
	// In < medium viewports we override this option and always show the publish sidebar.
	// See the edit-post's header component for the specific logic.
	ifViewportMatches( 'medium' ),
)( Option );

export const EnableTipsOption = compose(
	withSelect( ( select ) => ( {
		isChecked: select( 'core/nux' ).areTipsEnabled(),
	} ) ),
	withDispatch( ( dispatch ) => {
		const { enableTips, disableTips } = dispatch( 'core/nux' );
		return {
			onChange: ( isEnabled ) => ( isEnabled ? enableTips() : disableTips() ),
		};
	} )
)(
	// Using DeferredOption here means enableTips() is called when the Options
	// modal is dismissed. This stops the NUX guide from appearing above the
	// Options modal, which looks totally weird.
github WordPress / gutenberg / packages / edit-post / src / components / header / writing-menu / index.js View on Github external
info={ __( 'Focus on one block at a time' ) }
				messageActivated={ __( 'Spotlight mode activated' ) }
				messageDeactivated={ __( 'Spotlight mode deactivated' ) }
			/>
			
		
	);
}

export default ifViewportMatches( 'medium' )( WritingMenu );
github Automattic / wp-calypso / client / gutenberg / editor / edit-post / components / header / writing-menu / index.js View on Github external
feature="fixedToolbar"
				label={ __( 'Top Toolbar' ) }
				info={ __( 'Access all block and document tools in a single place' ) }
				onToggle={ onClose }
			/>
			
		
	);
}

export default ifViewportMatches( 'medium' )( WritingMenu );
github WordPress / gutenberg / editor / components / block-list / block-mobile-toolbar.js View on Github external
*/
import BlockMover from '../block-mover';
import BlockSettingsMenu from '../block-settings-menu';
import VisualEditorInserter from '../inserter';

function BlockMobileToolbar( { rootUID, uid, renderBlockMenu } ) {
	return (
		<div>
			
			
			
		</div>
	);
}

export default ifViewportMatches( '&lt; small' )( BlockMobileToolbar );

@wordpress/viewport

Viewport module for WordPress.

GPL-2.0-or-later
Latest version published 12 days ago

Package Health Score

95 / 100
Full package analysis