@@ -9,12 +9,12 @@ import { filter } from 'lodash';
99import { Component } from '@wordpress/element' ;
1010import { __ } from '@wordpress/i18n' ;
1111import { mediaUpload } from '@wordpress/utils' ;
12- import { Dashicon , DropZone , Toolbar , Placeholder , FormFileUpload } from '@wordpress/components' ;
12+ import { IconButton , Button , DropZone , Toolbar , Placeholder , FormFileUpload } from '@wordpress/components' ;
1313
1414/**
1515 * Internal dependencies
1616 */
17- import MediaUploadButton from '../../media-upload-button ' ;
17+ import MediaUpload from '../../media-upload' ;
1818import InspectorControls from '../../inspector-controls' ;
1919import RangeControl from '../../inspector-controls/range-control' ;
2020import ToggleControl from '../../inspector-controls/toggle-control' ;
@@ -146,7 +146,6 @@ class GalleryBlock extends Component {
146146 />
147147 ) ;
148148
149- const editButtonLabel = __ ( 'Edit Gallery' ) ;
150149 const controls = (
151150 focus && (
152151 < BlockControls key = "controls" >
@@ -156,29 +155,28 @@ class GalleryBlock extends Component {
156155 />
157156 { ! ! images . length && (
158157 < Toolbar >
159- < MediaUploadButton
160- buttonProps = { {
161- className : 'components-icon-button components-toolbar__control' ,
162- 'aria-label' : editButtonLabel ,
163- } }
158+ < MediaUpload
164159 onSelect = { this . onSelectImages }
165160 type = "image"
166161 multiple
167162 gallery
168163 value = { images . map ( ( img ) => img . id ) }
169- tooltip = { editButtonLabel }
170- >
171- < Dashicon icon = "edit" />
172- </ MediaUploadButton >
164+ render = { ( { open } ) => (
165+ < IconButton
166+ className = "components-toolbar__control"
167+ label = { __ ( 'Edit Gallery' ) }
168+ icon = "edit"
169+ onClick = { open }
170+ />
171+ ) }
172+ />
173173 </ Toolbar >
174174 ) }
175175 </ BlockControls >
176176 )
177177 ) ;
178178
179179 if ( images . length === 0 ) {
180- const uploadButtonProps = { isLarge : true } ;
181-
182180 return [
183181 controls ,
184182 < Placeholder
@@ -197,15 +195,17 @@ class GalleryBlock extends Component {
197195 >
198196 { __ ( 'Upload' ) }
199197 </ FormFileUpload >
200- < MediaUploadButton
201- buttonProps = { uploadButtonProps }
198+ < MediaUpload
202199 onSelect = { this . onSelectImages }
203200 type = "image"
204201 multiple
205202 gallery
206- >
207- { __ ( 'Add from Media Library' ) }
208- </ MediaUploadButton >
203+ render = { ( { open } ) => (
204+ < Button isLarge onClick = { open } >
205+ { __ ( 'Add from Media Library' ) }
206+ </ Button >
207+ ) }
208+ />
209209 </ Placeholder > ,
210210 ] ;
211211 }
0 commit comments