PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.8
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 / instructor-elements / instructor-background / edit.js

edit.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.8, at assets/src/apps/js/blocks/instructor-elements/instructor-background/edit.js

73 lines 2.0 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 { useBlockProps, InspectorControls } from '@wordpress/block-editor';
3 import { PanelBody, ToggleControl, SelectControl } from '@wordpress/components';
4
5 export const edit = ( props ) => {
6 const blockProps = useBlockProps();
7 const position = [
8 { label: 'Center', value: 'center' },
9 { label: 'Left', value: 'left' },
10 { label: 'Right', value: 'right' },
11 { label: 'Top', value: 'top' },
12 { label: 'Bottom', value: 'bottom' },
13 ];
14
15 const size = [
16 { label: 'Auto', value: 'auto' },
17 { label: 'Cover', value: 'cover' },
18 { label: 'Contain', value: 'contain' },
19 { label: 'Unset', value: 'unset' },
20 ];
21
22 return (
23 <>
24 <InspectorControls>
25 <PanelBody title={ __( 'Settings', 'learnpress' ) }>
26 <SelectControl
27 label={ __( 'Background Position', 'learnpress' ) }
28 value={ props.attributes.position }
29 options={ position }
30 onChange={ ( value ) =>
31 props.setAttributes( {
32 position: value ? value : '',
33 } )
34 }
35 />
36
37 <SelectControl
38 label={ __( 'Background Size', 'learnpress' ) }
39 value={ props.attributes.size }
40 options={ size }
41 onChange={ ( value ) =>
42 props.setAttributes( {
43 size: value ? value : '',
44 } )
45 }
46 />
47
48 <ToggleControl
49 label={ __( 'Background Repeat', 'learnpress' ) }
50 checked={ props.attributes.repeat ? true : false }
51 onChange={ ( value ) => {
52 props.setAttributes( {
53 repeat: value ? true : false,
54 } );
55 } }
56 />
57 </PanelBody>
58 </InspectorControls>
59 <div { ...blockProps }>
60 <div className="lp-user-cover-image_background">
61 <img
62 src="/wp-content/plugins/learnpress/assets/images/no-image.png"
63 alt="Instructor background placeholder"
64 height={ 285 }
65 width={ 1280 }
66 style={ { aspectRatio: 4.5, objectFit: 'cover' } }
67 ></img>
68 </div>
69 </div>
70 </>
71 );
72 };
73