How to use the @wordpress/components.withNotices function in @wordpress/components

To help you get started, we’ve selected a few @wordpress/components 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 Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / story / edit.js View on Github external
'height',
	] );
	mediaProps.url =
		get( media, [ 'sizes', sizeSlug, 'url' ] ) ||
		get( media, [ 'media_details', 'sizes', sizeSlug, 'source_url' ] ) ||
		get( media, [ 'media_details', 'videopress', 'original' ] ) ||
		get( media, [ 'media_details', 'original', 'url' ] ) ||
		media.url;
	mediaProps.type = media.media_type || media.type;
	mediaProps.mime = media.mime_type || media.mime;
	mediaProps.width = mediaProps.width || get( media, [ 'media_details', 'width' ] );
	mediaProps.height = mediaProps.height || get( media, [ 'media_details', 'height' ] );
	return mediaProps;
};

export default withNotices( function StoryEdit( {
	attributes,
	className,
	isSelected,
	noticeOperations,
	noticeUI,
	setAttributes,
} ) {
	const { mediaFiles } = attributes;
	const { lockPostSaving, unlockPostSaving } = useDispatch( 'core/editor' );
	const lockName = 'storyBlockLock';

	const onSelectMedia = newMediaFiles => {
		const allMedia = newMediaFiles.map( file => pickRelevantMediaFiles( file ) );
		const uploadedMedias = allMedia.filter( media => ! isBlobURL( media.url ) );
		// prevent saving blob urls in mediaFiles block attribute
		if ( allMedia.length !== uploadedMedias.length ) {
github WordPress / gutenberg / core-blocks / audio / edit.js View on Github external
setAttributes( { caption: value } ) }
							inlineToolbar
						/>
					) }
				
			
		);
		/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */
	}
}

export default withNotices( AudioEdit );
github pristas-peter / wp-graphql-gutenberg / src / Admin / settings.js View on Github external
{ this.state.progress !== null && this.state.total !== null
										? `${ this.state.progress } / ${ this.state.total }`
										: null }
								
							
						
					
				
			
		);
	}
}

export default withNotices( Settings );
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / calendly / edit.js View on Github external
if ( isResolvingUrl ) {
		return blockEmbedding;
	}

	const classes = `${ className } calendly-style-${ style }`;

	return (
		<div>
			{ inspectorControls }
			{ url &amp;&amp; ! isEditingUrl ? blockPreview( style ) : blockPlaceholder }
		</div>
	);
}

export default withNotices( CalendlyEdit );
github Automattic / wp-calypso / packages / jetpack-blocks / src / blocks / map / edit.js View on Github external
);
		return (
			
				{ noticeUI }
				{ apiState === API_STATE_LOADING &amp;&amp; placholderAPIStateLoading }
				{ apiState === API_STATE_FAILURE &amp;&amp; placeholderAPIStateFailure }
				{ apiState === API_STATE_SUCCESS &amp;&amp; placeholderAPIStateSuccess }
			
		);
	}
}

export default withNotices( MapEdit );
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / amazon / edit.js View on Github external
{ __( 'Shop Now', 'jetpack' ) }
					
				) }
			
		);
	};

	return (
		<div>
			{ inspectorControls }
			{ asin ? blockPreview() : blockPlaceholder }
		</div>
	);
}

export default withNotices( AmazonEdit );
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / shared / external-media / sources / with-media.js View on Github external
setAuthenticated={ this.setAuthenticated }
								multiple={ multiple }
								path={ path }
								onChangePath={ this.onChangePath }
							/&gt;
						
					
				);
			}
		}

		return withSelect( select =&gt; {
			return {
				postId: select( 'core/editor' ).getCurrentPostId(),
			};
		} )( withNotices( WithMediaComponent ) );
	} );
}
github Automattic / jetpack / extensions / blocks / tiled-gallery / edit.js View on Github external
className="tiled-gallery__add-item-button"
								onChange={ this.uploadFromFiles }
								accept="image/*"
								icon="insert"
							&gt;
								{ __( 'Upload an image', 'jetpack' ) }
							
						
					) }
				
			
		);
	}
}

export default withNotices( TiledGalleryEdit );
github Automattic / jetpack / extensions / blocks / membership-button / edit.jsx View on Github external
{ this.renderMembershipAmounts() }
								{ __( 'Or add another membership amount:', 'jetpack' ) }
								<br>
								{ this.renderAddMembershipAmount() }
								{ this.renderDisclaimer() }
							
						
					) }
				{ this.state.products &amp;&amp; inspectorControls }
				{ this.props.attributes.planId &amp;&amp; blockContent }
			
		);
	};
}

export default withNotices( MembershipsButtonEdit );
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / mailchimp / edit.js View on Github external
const previewUI = blockContent;

		return (
			
				{ noticeUI }
				{ preview &amp;&amp; previewUI }
				{ ! preview &amp;&amp; connected === API_STATE_LOADING &amp;&amp; waiting }
				{ ! preview &amp;&amp; connected === API_STATE_NOTCONNECTED &amp;&amp; placeholder }
				{ ! preview &amp;&amp; connected === API_STATE_CONNECTED &amp;&amp; inspectorControls }
				{ ! preview &amp;&amp; connected === API_STATE_CONNECTED &amp;&amp; blockContent }
			
		);
	};
}

export default withNotices( MailchimpSubscribeEdit );