index.js
19 lines
| 1 | import { TextControl } from '@wordpress/components'; |
| 2 | import { __ } from '@wordpress/i18n'; |
| 3 | |
| 4 | export default function BlockLabel( { value, onChange } ) { |
| 5 | // WordPress now has a `blockName` option that handles this. |
| 6 | if ( ! value ) { |
| 7 | return null; |
| 8 | } |
| 9 | |
| 10 | return ( |
| 11 | <TextControl |
| 12 | label={ __( 'Block label', 'generateblocks' ) } |
| 13 | help={ __( 'Add a label for this block in the List View.', 'generateblocks' ) } |
| 14 | value={ value } |
| 15 | onChange={ onChange } |
| 16 | /> |
| 17 | ); |
| 18 | } |
| 19 |