PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.0.0
GenerateBlocks v2.0.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
76 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 currentAtRule,
22 } = useBlockStyles();
23
24 const panelProps = {
25 name,
26 attributes,
27 setAttributes,
28 };
29
30 const {
31 tagName,
32 } = attributes;
33
34 return (
35 <ApplyFilters
36 name="generateblocks.editor.blockControls"
37 blockName={ name }
38 getStyleValue={ getStyleValue }
39 onStyleChange={ onStyleChange }
40 currentAtRule={ currentAtRule }
41 attributes={ attributes }
42 setAttributes={ setAttributes }
43 >
44 <OpenPanel
45 { ...panelProps }
46 dropdownOptions={ [
47 moreDesignOptions,
48 ] }
49 panelId="design"
50 >
51 <GridColumnSelector
52 label={ __( 'Layout', 'generateblocks' ) }
53 value={ getStyleValue( 'gridTemplateColumns', currentAtRule ) }
54 onClick={ ( value ) => {
55 onStyleChange( 'display', 'grid', currentAtRule );
56 onStyleChange( 'gridTemplateColumns', value, currentAtRule );
57 } }
58 />
59 </OpenPanel>
60
61 <OpenPanel
62 { ...panelProps }
63 panelId="settings"
64 >
65 <TagNameControl
66 blockName="generateblocks/looper"
67 value={ tagName }
68 onChange={ ( value ) => {
69 setAttributes( { tagName: value } );
70 } }
71 />
72 </OpenPanel>
73 </ApplyFilters>
74 );
75 }
76