PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.2.0
GenerateBlocks v2.2.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 / blocks / looper / components / BlockSettings.jsx
generateblocks / src / blocks / looper / components Last commit date
BlockSettings.jsx 1 year ago LoopInnerBlocksRenderer.jsx 1 year ago
BlockSettings.jsx
80 lines
1 import { __ } from '@wordpress/i18n';
2
3 import { OpenPanel } from '@edge22/components';
4
5 import {
6 ApplyFilters,
7 GridColumnSelector,
8 TagNameControl,
9 } from '@components/index.js';
10 import { moreDesignOptions } from '@utils';
11 import { useBlockStyles } from '@hooks/useBlockStyles';
12
13 export function BlockSettings( {
14 getStyleValue,
15 onStyleChange,
16 name,
17 attributes,
18 setAttributes,
19 } ) {
20 const {
21 atRule,
22 } = useBlockStyles();
23
24 const panelProps = {
25 name,
26 attributes,
27 setAttributes,
28 getStyleValue,
29 onStyleChange,
30 };
31
32 const {
33 tagName,
34 } = attributes;
35
36 return (
37 <ApplyFilters
38 name="generateblocks.editor.blockControls"
39 blockName={ name }
40 getStyleValue={ getStyleValue }
41 onStyleChange={ onStyleChange }
42 currentAtRule={ atRule }
43 attributes={ attributes }
44 setAttributes={ setAttributes }
45 >
46 <OpenPanel
47 { ...panelProps }
48 dropdownOptions={ [
49 moreDesignOptions,
50 ] }
51 panelId="design"
52 >
53 <GridColumnSelector
54 label={ __( 'Layout', 'generateblocks' ) }
55 value={ getStyleValue( 'gridTemplateColumns', atRule ) }
56 onClick={ ( value ) => {
57 onStyleChange( 'display', 'grid', atRule );
58 onStyleChange( 'gridTemplateColumns', value, atRule );
59 } }
60 />
61 </OpenPanel>
62
63 <OpenPanel
64 { ...panelProps }
65 panelId="settings"
66 >
67 { '' === atRule && (
68 <TagNameControl
69 blockName="generateblocks/looper"
70 value={ tagName }
71 onChange={ ( value ) => {
72 setAttributes( { tagName: value } );
73 } }
74 />
75 ) }
76 </OpenPanel>
77 </ApplyFilters>
78 );
79 }
80