AddQueryParameterButton.jsx
1 year ago
BlockSettings.jsx
1 year ago
ControlBuilder.jsx
1 year ago
DateQueryControl.jsx
1 year ago
DateTimeControl.jsx
1 year ago
ParameterControl.jsx
1 year ago
ParameterList.jsx
1 year ago
QueryInspectorControls.jsx
1 year ago
SelectQueryParameter.jsx
1 year ago
TaxonomyParameterControl.jsx
1 year ago
editor.scss
1 year ago
BlockSettings.jsx
71 lines
| 1 | import { OpenPanel } from '@edge22/components'; |
| 2 | |
| 3 | import { |
| 4 | ApplyFilters, |
| 5 | TagNameControl, |
| 6 | } from '@components/index.js'; |
| 7 | |
| 8 | import { QueryInspectorControls } from './QueryInspectorControls'; |
| 9 | import { useBlockStyles } from '@hooks/useBlockStyles'; |
| 10 | |
| 11 | export function BlockSettings( { |
| 12 | onStyleChange, |
| 13 | getStyleValue, |
| 14 | name, |
| 15 | attributes, |
| 16 | setAttributes, |
| 17 | context, |
| 18 | } ) { |
| 19 | const panelProps = { |
| 20 | name, |
| 21 | attributes, |
| 22 | setAttributes, |
| 23 | getStyleValue, |
| 24 | onStyleChange, |
| 25 | }; |
| 26 | |
| 27 | const { |
| 28 | tagName, |
| 29 | } = attributes; |
| 30 | |
| 31 | const { |
| 32 | atRule, |
| 33 | } = useBlockStyles(); |
| 34 | |
| 35 | return ( |
| 36 | <ApplyFilters |
| 37 | name="generateblocks.editor.blockControls" |
| 38 | blockName={ name } |
| 39 | onStyleChange={ onStyleChange } |
| 40 | getStyleValue={ getStyleValue } |
| 41 | attributes={ attributes } |
| 42 | setAttributes={ setAttributes } |
| 43 | > |
| 44 | <OpenPanel |
| 45 | { ...panelProps } |
| 46 | panelId="query-parameters" |
| 47 | > |
| 48 | <QueryInspectorControls |
| 49 | attributes={ attributes } |
| 50 | setAttributes={ setAttributes } |
| 51 | context={ context } |
| 52 | /> |
| 53 | </OpenPanel> |
| 54 | <OpenPanel |
| 55 | { ...panelProps } |
| 56 | panelId="settings" |
| 57 | > |
| 58 | { '' === atRule && ( |
| 59 | <TagNameControl |
| 60 | blockName="generateblocks/query" |
| 61 | value={ tagName } |
| 62 | onChange={ ( value ) => { |
| 63 | setAttributes( { tagName: value } ); |
| 64 | } } |
| 65 | /> |
| 66 | ) } |
| 67 | </OpenPanel> |
| 68 | </ApplyFilters> |
| 69 | ); |
| 70 | } |
| 71 |