/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { BlockControls, MediaPlaceholder, MediaUpload } from '@wordpress/editor'; import { Fragment } from '@wordpress/element'; import { get } from 'lodash'; import { IconButton, Toolbar, ToolbarButton } from '@wordpress/components'; const onSelectMedia = setAttributes => media => setAttributes( { featuredMediaId: get( media, 'id', 0 ), featuredMediaUrl: get( media, 'url', null ), featuredMediaTitle: get( media, 'title', null ), } ); export default ( { featuredMediaId, featuredMediaUrl, featuredMediaTitle, setAttributes } ) => { if ( ! featuredMediaId ) { return ( ); } return (
( ) } /> setAttributes( { featuredMediaId: null, featuredMediaUrl: null, featuredMediaTitle: null, } ) } />
{
); };