PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.0
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.0
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / assets / src / apps / js / blocks / course-elements / course-offline-lesson / edit.js

edit.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.0, at assets/src/apps/js/blocks/course-elements/course-offline-lesson/edit.js

59 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
3 import { PanelBody, ToggleControl } from '@wordpress/components';
4 import { useState, useEffect } from '@wordpress/element';
5
6 const Edit = ( props ) => {
7 const blockProps = useBlockProps();
8 const { attributes, setAttributes, context } = props;
9 const { lpCourseData } = context;
10 const courseLesson =
11 '<div class="course-count-lesson"><div class="course-count-item lp_lesson">5</div></div>';
12
13 return (
14 <>
15 <InspectorControls>
16 <PanelBody title={ __( 'Settings', 'learnpress' ) }>
17 <ToggleControl
18 label={ __( 'Show Label', 'learnpress' ) }
19 checked={ attributes.showLabel }
20 onChange={ ( value ) => {
21 setAttributes( {
22 showLabel: value,
23 } );
24 } }
25 />
26 <ToggleControl
27 label={ __( 'Show Icon', 'learnpress' ) }
28 checked={ attributes.showIcon }
29 onChange={ ( value ) => {
30 setAttributes( {
31 showIcon: value,
32 } );
33 } }
34 />
35 </PanelBody>
36 </InspectorControls>
37
38 <div { ...blockProps }>
39 <div className="info-meta-item">
40 <span className="info-meta-left">
41 { attributes.showIcon && (
42 <span dangerouslySetInnerHTML={ { __html: '<i class="lp-icon-file-o"></i>' } } />
43 ) }
44 { attributes.showLabel ? __( 'Lesson:', 'learnpress' ) : '' }
45 </span>
46 <span
47 className="info-meta-right"
48 dangerouslySetInnerHTML={ {
49 __html: courseLesson,
50 } }
51 ></span>
52 </div>
53 </div>
54 </>
55 );
56 };
57
58 export default Edit;
59