PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / blocks / src / loop / description / edit.js
shop-press / blocks / src / loop / description Last commit date
block.json 1 year ago edit.js 1 year ago index.js 2 years ago render.php 2 years ago
edit.js
147 lines
1 import { __ } from '@wordpress/i18n';
2 import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
3 import { PanelBody } from '@wordpress/components';
4 import Styler from '../../styler';
5 import Wrapper from '../../wrapper';
6
7 const Inspector = ( { attributes, setAttributes, clientId } ) => {
8 return (
9 <InspectorControls>
10 <PanelBody
11 title={ __( 'Styles', 'shop-press' ) }
12 initialOpen={ true }
13 >
14 <Styler
15 clientId={ clientId }
16 label={ __( 'Wrapper', 'shop-press' ) }
17 selector=" .sp-product-description"
18 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
19 attributes={ attributes }
20 setAttributes={ setAttributes }
21 />
22
23 <Styler
24 clientId={ clientId }
25 label={ __( 'Div', 'shop-press' ) }
26 selector=".sp-product-description div"
27 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
28 attributes={ attributes }
29 setAttributes={ setAttributes }
30 />
31
32 <Styler
33 clientId={ clientId }
34 label={ __( 'Paragraph', 'shop-press' ) }
35 selector=".sp-product-description p"
36 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
37 attributes={ attributes }
38 setAttributes={ setAttributes }
39 />
40
41 <Styler
42 clientId={ clientId }
43 label={ __( 'Heading 1', 'shop-press' ) }
44 selector=".sp-product-description h1"
45 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
46 attributes={ attributes }
47 setAttributes={ setAttributes }
48 />
49
50 <Styler
51 clientId={ clientId }
52 label={ __( 'Heading 2', 'shop-press' ) }
53 selector=".sp-product-description h2"
54 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
55 attributes={ attributes }
56 setAttributes={ setAttributes }
57 />
58
59 <Styler
60 clientId={ clientId }
61 label={ __( 'Heading 3', 'shop-press' ) }
62 selector=".sp-product-description h3"
63 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
64 attributes={ attributes }
65 setAttributes={ setAttributes }
66 />
67
68 <Styler
69 clientId={ clientId }
70 label={ __( 'Heading 4', 'shop-press' ) }
71 selector=".sp-product-description h4"
72 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
73 attributes={ attributes }
74 setAttributes={ setAttributes }
75 />
76
77 <Styler
78 clientId={ clientId }
79 label={ __( 'Heading 5', 'shop-press' ) }
80 selector=".sp-product-description h5"
81 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
82 attributes={ attributes }
83 setAttributes={ setAttributes }
84 />
85
86 <Styler
87 clientId={ clientId }
88 label={ __( 'Heading 6', 'shop-press' ) }
89 selector=".sp-product-description h6"
90 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
91 attributes={ attributes }
92 setAttributes={ setAttributes }
93 />
94
95 <Styler
96 clientId={ clientId }
97 label={ __( 'Span', 'shop-press' ) }
98 selector=".sp-product-description span"
99 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
100 attributes={ attributes }
101 setAttributes={ setAttributes }
102 />
103
104 <Styler
105 clientId={ clientId }
106 label={ __( 'Strong', 'shop-press' ) }
107 selector=".sp-product-description strong"
108 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
109 attributes={ attributes }
110 setAttributes={ setAttributes }
111 />
112
113 <Styler
114 clientId={ clientId }
115 label={ __( 'Link', 'shop-press' ) }
116 selector=".sp-product-description a"
117 wrapper={ `.${ attributes[ 'wrapperID' ] }` }
118 attributes={ attributes }
119 setAttributes={ setAttributes }
120 />
121 </PanelBody>
122 </InspectorControls>
123 );
124 };
125
126 const Edit = ( props ) => {
127 const { attributes, setAttributes, clientId } = props;
128 const blockProps = useBlockProps();
129
130 return (
131 <div { ...blockProps }>
132 <Inspector
133 attributes={ attributes }
134 setAttributes={ setAttributes }
135 clientId={ clientId }
136 />
137 <Wrapper { ...props }>
138 <div className="sp-product-description">
139 <p>This is a simple product.</p>
140 </div>
141 </Wrapper>
142 </div>
143 );
144 };
145
146 export default Edit;
147