generateblocks
/
src
/
extend
/
inspector-control
/
controls
/
background-panel
/
components
/
image-size.js
generateblocks
/
src
/
extend
/
inspector-control
/
controls
/
background-panel
/
components
Last commit date
attachment.js
3 years ago
background-color-overlay.js
3 years ago
background-options.js
2 years ago
image-opacity.js
3 years ago
image-size.js
3 years ago
image-url.js
3 years ago
position.js
3 years ago
repeat.js
3 years ago
selector.js
3 years ago
size.js
3 years ago
use-inline-style.js
3 years ago
image-size.js
23 lines
| 1 | import { __ } from '@wordpress/i18n'; |
| 2 | import { SelectControl } from '@wordpress/components'; |
| 3 | |
| 4 | export default function ImageSize( { value, onChange } ) { |
| 5 | const bgImageSizes = []; |
| 6 | |
| 7 | Object.keys( generateBlocksInfo.imageSizes ).forEach( ( size ) => { |
| 8 | bgImageSizes.push( { |
| 9 | label: generateBlocksInfo.imageSizes[ size ], |
| 10 | value: generateBlocksInfo.imageSizes[ size ], |
| 11 | } ); |
| 12 | } ); |
| 13 | |
| 14 | return ( |
| 15 | <SelectControl |
| 16 | label={ __( 'Image Size', 'generateblocks' ) } |
| 17 | value={ value } |
| 18 | options={ bgImageSizes } |
| 19 | onChange={ onChange } |
| 20 | /> |
| 21 | ); |
| 22 | } |
| 23 |