PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.0
GenerateBlocks v1.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / components / panel-area / index.js
generateblocks / src / components / panel-area Last commit date
index.js 6 years ago
index.js
57 lines
1 import ApplyFilters from '../apply-filters/';
2
3 const {
4 PanelBody,
5 } = wp.components;
6
7 const {
8 Component,
9 } = wp.element;
10
11 const {
12 applyFilters,
13 } = wp.hooks;
14
15 /**
16 * Component Class
17 */
18 export default class PanelArea extends Component {
19 render() {
20 const {
21 title = false,
22 initialOpen = false,
23 icon,
24 className,
25 id,
26 state,
27 showPanel = true,
28 children,
29 } = this.props;
30
31 const show = applyFilters( 'generateblocks.editor.showPanel', showPanel, id, this.props );
32
33 if ( ! show ) {
34 return null;
35 }
36
37 return (
38 <ApplyFilters name={ 'generateblocks.panel.' + id } props={ this.props } state={ state }>
39 { title ? (
40 <PanelBody
41 title={ title }
42 initialOpen={ initialOpen }
43 icon={ icon }
44 className={ className }
45 >
46 { children }
47 </PanelBody>
48 ) : (
49 <PanelBody>
50 { children }
51 </PanelBody>
52 ) }
53 </ApplyFilters>
54 );
55 }
56 }
57