| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; |
| 3 |
import { PanelBody, SelectControl } from '@wordpress/components'; |
| 4 |
|
| 5 |
export const edit = ( props ) => { |
| 6 |
const blockProps = useBlockProps(); |
| 7 |
const mode = [ |
| 8 |
{ label: 'Icon + Number + Text', value: '' }, |
| 9 |
{ label: 'Icon + Number', value: 'text' }, |
| 10 |
{ label: 'Number + Text', value: 'icon' }, |
| 11 |
]; |
| 12 |
|
| 13 |
return ( |
| 14 |
<> |
| 15 |
<InspectorControls> |
| 16 |
<PanelBody title={ __( 'Settings', 'learnpress' ) }> |
| 17 |
<SelectControl |
| 18 |
label={ __( 'Display Modes', 'learnpress' ) } |
| 19 |
value={ props.attributes.hidden } |
| 20 |
options={ mode } |
| 21 |
onChange={ ( value ) => |
| 22 |
props.setAttributes( { |
| 23 |
hidden: value ? value : '', |
| 24 |
} ) |
| 25 |
} |
| 26 |
/> |
| 27 |
</PanelBody> |
| 28 |
</InspectorControls> |
| 29 |
<div { ...blockProps }> |
| 30 |
<div className="wrapper-instructor-total-courses"> |
| 31 |
{ props.attributes.hidden && props.attributes.hidden === 'icon' ? ( |
| 32 |
'' |
| 33 |
) : ( |
| 34 |
<span className="lp-ico lp-icon-courses"></span> |
| 35 |
) } |
| 36 |
<span className="instructor-total-courses">{ '99' }</span> |
| 37 |
{ props.attributes.hidden && props.attributes.hidden === 'text' ? ( |
| 38 |
'' |
| 39 |
) : ( |
| 40 |
<span>{ ' Courses' }</span> |
| 41 |
) } |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
</> |
| 45 |
); |
| 46 |
}; |
| 47 |
|