@webikon/webentor-core 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.husky/pre-commit +40 -0
  2. package/.prettierrc.js +5 -0
  3. package/CHANGELOG.md +88 -0
  4. package/LICENCE.md +7 -0
  5. package/README.md +26 -0
  6. package/core-js/_alpine.ts +20 -0
  7. package/core-js/_slider.ts +232 -0
  8. package/core-js/_utils.ts +126 -0
  9. package/core-js/blocks-components/block-appender.tsx +36 -0
  10. package/core-js/blocks-components/button.tsx +424 -0
  11. package/core-js/blocks-components/custom-image-sizes-panel.tsx +197 -0
  12. package/core-js/blocks-components/index.ts +4 -0
  13. package/core-js/blocks-components/typography-picker-select.tsx +31 -0
  14. package/core-js/blocks-filters/_filter-core-typography.tsx +108 -0
  15. package/core-js/blocks-filters/_slider-settings.tsx +283 -0
  16. package/core-js/blocks-filters/index.ts +3 -0
  17. package/core-js/blocks-filters/responsive-settings/components/DisabledSliderInfo.tsx +10 -0
  18. package/core-js/blocks-filters/responsive-settings/constants.ts +11 -0
  19. package/core-js/blocks-filters/responsive-settings/index.tsx +196 -0
  20. package/core-js/blocks-filters/responsive-settings/settings/block-link/index.ts +1 -0
  21. package/core-js/blocks-filters/responsive-settings/settings/block-link/panel.tsx +47 -0
  22. package/core-js/blocks-filters/responsive-settings/settings/border/border/index.tsx +1 -0
  23. package/core-js/blocks-filters/responsive-settings/settings/border/border/properties.ts +27 -0
  24. package/core-js/blocks-filters/responsive-settings/settings/border/border/settings.tsx +310 -0
  25. package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/index.tsx +1 -0
  26. package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/properties.ts +31 -0
  27. package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/settings.tsx +211 -0
  28. package/core-js/blocks-filters/responsive-settings/settings/border/index.ts +1 -0
  29. package/core-js/blocks-filters/responsive-settings/settings/border/panel.tsx +54 -0
  30. package/core-js/blocks-filters/responsive-settings/settings/container/display/index.ts +2 -0
  31. package/core-js/blocks-filters/responsive-settings/settings/container/display/properties.ts +167 -0
  32. package/core-js/blocks-filters/responsive-settings/settings/container/display/settings.tsx +73 -0
  33. package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/index.ts +2 -0
  34. package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/properties.ts +187 -0
  35. package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/settings.tsx +131 -0
  36. package/core-js/blocks-filters/responsive-settings/settings/container/grid/index.ts +2 -0
  37. package/core-js/blocks-filters/responsive-settings/settings/container/grid/properties.ts +187 -0
  38. package/core-js/blocks-filters/responsive-settings/settings/container/grid/settings.tsx +132 -0
  39. package/core-js/blocks-filters/responsive-settings/settings/container/index.ts +4 -0
  40. package/core-js/blocks-filters/responsive-settings/settings/container/panel.tsx +92 -0
  41. package/core-js/blocks-filters/responsive-settings/settings/spacing/index.ts +3 -0
  42. package/core-js/blocks-filters/responsive-settings/settings/spacing/panel.tsx +45 -0
  43. package/core-js/blocks-filters/responsive-settings/settings/spacing/properties.ts +74 -0
  44. package/core-js/blocks-filters/responsive-settings/settings/spacing/settings.tsx +85 -0
  45. package/core-js/blocks-filters/responsive-settings/types/index.ts +68 -0
  46. package/core-js/blocks-filters/responsive-settings/utils.ts +321 -0
  47. package/core-js/blocks-utils/_use-block-parent.ts +27 -0
  48. package/core-js/blocks-utils/_use-post-types.ts +43 -0
  49. package/core-js/blocks-utils/_use-taxonomies.ts +29 -0
  50. package/core-js/blocks-utils/index.ts +3 -0
  51. package/core-js/config/webentor-config.ts +718 -0
  52. package/core-js/index.ts +14 -0
  53. package/core-js/types/_block-components.ts +7 -0
  54. package/core-js/types/_webentor-config.ts +182 -0
  55. package/package.json +98 -0
  56. package/resources/blocks/e-accordion/block.json +34 -0
  57. package/resources/blocks/e-accordion/e-accordion.block.tsx +125 -0
  58. package/resources/blocks/e-accordion/script.ts +1 -0
  59. package/resources/blocks/e-accordion/style.css +8 -0
  60. package/resources/blocks/e-accordion-group/block.json +56 -0
  61. package/resources/blocks/e-accordion-group/e-accordion-group.block.tsx +99 -0
  62. package/resources/blocks/e-breadcrumbs/block.json +41 -0
  63. package/resources/blocks/e-breadcrumbs/e-breadcrumbs.block.tsx +53 -0
  64. package/resources/blocks/e-button/block.json +32 -0
  65. package/resources/blocks/e-button/e-button.block.tsx +55 -0
  66. package/resources/blocks/e-gallery/block.json +90 -0
  67. package/resources/blocks/e-gallery/e-gallery.block.tsx +316 -0
  68. package/resources/blocks/e-icon-picker/block.json +37 -0
  69. package/resources/blocks/e-icon-picker/e-icon-picker.block.tsx +230 -0
  70. package/resources/blocks/e-icon-picker/style.css +17 -0
  71. package/resources/blocks/e-image/block.json +78 -0
  72. package/resources/blocks/e-image/e-image.block.tsx +331 -0
  73. package/resources/blocks/e-picker-query-loop/block.json +25 -0
  74. package/resources/blocks/e-picker-query-loop/e-picker-query-loop.block.tsx +189 -0
  75. package/resources/blocks/e-post-template/block.json +25 -0
  76. package/resources/blocks/e-post-template/e-post-template.block.tsx +100 -0
  77. package/resources/blocks/e-query-loop/block.json +36 -0
  78. package/resources/blocks/e-query-loop/constants.tsx +8 -0
  79. package/resources/blocks/e-query-loop/e-query-loop.block.tsx +270 -0
  80. package/resources/blocks/e-query-loop/taxonomy-controls.tsx +184 -0
  81. package/resources/blocks/e-slider/block.json +42 -0
  82. package/resources/blocks/e-slider/e-slider.block.tsx +100 -0
  83. package/resources/blocks/e-svg/block.json +37 -0
  84. package/resources/blocks/e-svg/e-svg.block.tsx +156 -0
  85. package/resources/blocks/e-tab-container/block.json +49 -0
  86. package/resources/blocks/e-tab-container/e-tab-container.block.tsx +123 -0
  87. package/resources/blocks/e-table/block.json +30 -0
  88. package/resources/blocks/e-table/e-table.block.tsx +120 -0
  89. package/resources/blocks/e-table/script.ts +48 -0
  90. package/resources/blocks/e-table-cell/block.json +40 -0
  91. package/resources/blocks/e-table-cell/e-table-cell.block.tsx +180 -0
  92. package/resources/blocks/e-table-row/block.json +28 -0
  93. package/resources/blocks/e-table-row/e-table-row.block.tsx +118 -0
  94. package/resources/blocks/e-tabs/block.json +27 -0
  95. package/resources/blocks/e-tabs/e-tabs.block.tsx +90 -0
  96. package/resources/blocks/l-404/block.json +51 -0
  97. package/resources/blocks/l-404/l-404.block.tsx +75 -0
  98. package/resources/blocks/l-flexible-container/block.json +34 -0
  99. package/resources/blocks/l-flexible-container/l-flexible-container.block.tsx +97 -0
  100. package/resources/blocks/l-footer/block.json +23 -0
  101. package/resources/blocks/l-footer/l-footer.block.tsx +51 -0
  102. package/resources/blocks/l-formatted-content/block.json +28 -0
  103. package/resources/blocks/l-formatted-content/l-formatted-content.block.tsx +97 -0
  104. package/resources/blocks/l-header/block.json +26 -0
  105. package/resources/blocks/l-header/l-header.block.tsx +100 -0
  106. package/resources/blocks/l-mobile-nav/block.json +15 -0
  107. package/resources/blocks/l-mobile-nav/l-mobile-nav.block.tsx +56 -0
  108. package/resources/blocks/l-mobile-nav/style.css +54 -0
  109. package/resources/blocks/l-nav-menu/block.json +27 -0
  110. package/resources/blocks/l-nav-menu/l-nav-menu.block.tsx +109 -0
  111. package/resources/blocks/l-nav-menu/style.css +134 -0
  112. package/resources/blocks/l-post-card/block.json +13 -0
  113. package/resources/blocks/l-post-card/l-post-card.block.tsx +52 -0
  114. package/resources/blocks/l-section/block.json +89 -0
  115. package/resources/blocks/l-section/l-section.block.tsx +316 -0
  116. package/resources/blocks/l-site-logo/block.json +15 -0
  117. package/resources/blocks/l-site-logo/l-site-logo.block.tsx +54 -0
  118. package/resources/core-components/slider/slider.script.ts +11 -0
  119. package/resources/core-components/slider/slider.style.css +134 -0
  120. package/resources/scripts/editor.ts +29 -0
  121. package/resources/styles/app.css +21 -0
  122. package/resources/styles/common/_editor.css +86 -0
  123. package/resources/styles/common/_form.css +83 -0
  124. package/resources/styles/common/_global.css +73 -0
  125. package/resources/styles/common/_theme.css +75 -0
  126. package/resources/styles/common/_utilities.css +33 -0
  127. package/resources/styles/common/_wordpress.css +110 -0
  128. package/resources/styles/components/_table.css +102 -0
  129. package/resources/styles/editor.css +16 -0
  130. package/resources/styles/partials/.gitkeep +0 -0
  131. package/resources/styles/partials/_header.css +21 -0
  132. package/resources/styles/partials/_pagination.css +35 -0
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/l-404",
5
+ "title": "Block 404",
6
+ "description": "Block for 404",
7
+ "category": "webentor-layout",
8
+ "icon": "block-default",
9
+ "keywords": [
10
+ "404",
11
+ "block",
12
+ "layout"
13
+ ],
14
+ "attributes": {
15
+ "title": {
16
+ "type": "string",
17
+ "default": "Nothing found"
18
+ },
19
+ "button": {
20
+ "type": "object",
21
+ "properties": {
22
+ "showButton": {
23
+ "type": "boolean"
24
+ },
25
+ "title": {
26
+ "type": "string"
27
+ },
28
+ "variant": {
29
+ "type": "string"
30
+ },
31
+ "url": {
32
+ "type": "string"
33
+ }
34
+ },
35
+ "default": {
36
+ "showButton": true,
37
+ "title": "Go to homepage",
38
+ "variant": "primary",
39
+ "url": ""
40
+ }
41
+ }
42
+ },
43
+ "supports": {
44
+ "align": false,
45
+ "anchor": true,
46
+ "color": {
47
+ "background": true
48
+ },
49
+ "jsx": true
50
+ }
51
+ }
@@ -0,0 +1,75 @@
1
+ import { RichText, useBlockProps } from '@wordpress/block-editor';
2
+ import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
3
+ import { __ } from '@wordpress/i18n';
4
+
5
+ import { WebentorButton } from '@webentorCore/blocks-components';
6
+
7
+ import block from './block.json';
8
+
9
+ /**
10
+ * Edit component.
11
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
12
+ *
13
+ * @param {object} props The block props.
14
+ * @returns {Function} Render the edit screen
15
+ */
16
+
17
+ type AttributesType = {
18
+ coverImage: string;
19
+ title: string;
20
+ };
21
+
22
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
23
+ const { attributes, setAttributes } = props;
24
+
25
+ const blockProps = useBlockProps();
26
+
27
+ // Preview image for block inserter
28
+ if (attributes.coverImage) {
29
+ return <img src={attributes.coverImage} width="468" />;
30
+ }
31
+
32
+ return (
33
+ <>
34
+ <div {...blockProps} className={`${blockProps.className}`}>
35
+ <div className="md:wbtr:pt-8 wbtr:flex wbtr:w-full wbtr:flex-col wbtr:items-center wbtr:gap-8 wbtr:border wbtr:border-editor-border wbtr:px-4 wbtr:pt-5 wbtr:pb-4">
36
+ <div className="wbtr:flex wbtr:w-full wbtr:flex-col wbtr:items-center wbtr:gap-4">
37
+ <span className="wbtr:font-heading wbtr:text-80 wbtr:text-gray-800">
38
+ 404
39
+ </span>
40
+
41
+ <RichText
42
+ className="wbtr:text-gray-800 wbtr:uppercase"
43
+ tagName="h2"
44
+ placeholder={__('Title (required)', 'webentor')}
45
+ value={attributes.title}
46
+ onChange={(title) => setAttributes({ title })}
47
+ />
48
+ </div>
49
+
50
+ <WebentorButton
51
+ attributes={attributes}
52
+ setAttributes={setAttributes}
53
+ attributeName="button"
54
+ hideLink
55
+ />
56
+ </div>
57
+ </div>
58
+ </>
59
+ );
60
+ };
61
+
62
+ /**
63
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
64
+ *
65
+ * @return {null} Dynamic blocks do not save the HTML.
66
+ */
67
+ const BlockSave = () => null;
68
+
69
+ /**
70
+ * Register block.
71
+ */
72
+ registerBlockType(block, {
73
+ edit: BlockEdit,
74
+ save: BlockSave,
75
+ });
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "name": "webentor/l-flexible-container",
4
+ "apiVersion": 3,
5
+ "title": "Flexible Container",
6
+ "description": "Container block with a lot of flexible options.",
7
+ "category": "webentor-layout",
8
+ "icon": "layout",
9
+ "keywords": ["section", "container", "layout"],
10
+ "attributes": {
11
+ "template": {
12
+ "type": "array",
13
+ "default": null
14
+ }
15
+ },
16
+ "supports": {
17
+ "anchor": true,
18
+ "color": {
19
+ "background": true,
20
+ "text": true
21
+ },
22
+ "webentor": {
23
+ "spacing": true,
24
+ "display": true,
25
+ "grid": true,
26
+ "gridItem": true,
27
+ "flexbox": true,
28
+ "flexboxItem": true,
29
+ "blockLink": true,
30
+ "border": true,
31
+ "borderRadius": true
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,97 @@
1
+ import {
2
+ InnerBlocks,
3
+ useBlockProps,
4
+ useInnerBlocksProps,
5
+ } from '@wordpress/block-editor';
6
+ import {
7
+ BlockEditProps,
8
+ registerBlockType,
9
+ TemplateArray,
10
+ } from '@wordpress/blocks';
11
+ import { applyFilters } from '@wordpress/hooks';
12
+ import { __ } from '@wordpress/i18n';
13
+
14
+ import { useBlockParent } from '@webentorCore/blocks-utils/_use-block-parent';
15
+
16
+ import block from './block.json';
17
+
18
+ /**
19
+ * Edit component.
20
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
21
+ *
22
+ * @param {object} props The block props.
23
+ * @returns {Function} Render the edit screen
24
+ */
25
+
26
+ type AttributesType = {
27
+ coverImage: string;
28
+ template: TemplateArray;
29
+ };
30
+
31
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
32
+ const { attributes } = props;
33
+
34
+ const blockProps = useBlockProps();
35
+ const parentBlockProps = useBlockParent();
36
+
37
+ /**
38
+ * Filter allowed blocks used in webentor/l-flexible-container inner block
39
+ */
40
+ const allowedBlocks: string[] = applyFilters(
41
+ 'webentor.core.l-flexible-container.allowedBlocks',
42
+ null,
43
+ blockProps,
44
+ parentBlockProps,
45
+ );
46
+
47
+ /**
48
+ * Filter template used in webentor/l-flexible-container inner block
49
+ */
50
+ const defaultTemplate: TemplateArray = attributes?.template ?? [];
51
+ const template: TemplateArray = applyFilters(
52
+ 'webentor.core.l-flexible-container.template',
53
+ defaultTemplate,
54
+ blockProps,
55
+ parentBlockProps,
56
+ );
57
+
58
+ const { children, ...innerBlocksProps } = useInnerBlocksProps(blockProps, {
59
+ allowedBlocks,
60
+ template,
61
+ });
62
+
63
+ // Preview image for block inserter
64
+ if (attributes.coverImage) {
65
+ return <img src={attributes.coverImage} width="468" />;
66
+ }
67
+
68
+ return (
69
+ <div
70
+ {...innerBlocksProps}
71
+ className={`${innerBlocksProps.className} wbtr-flexible-container wbtr:relative wbtr:p-2 wbtr:pt-4`}
72
+ >
73
+ <div className="wbtr:pointer-events-none wbtr:absolute wbtr:inset-0 wbtr:h-full wbtr:w-full wbtr:border wbtr:border-dashed wbtr:border-editor-border wbtr:p-2 wbtr:pt-4"></div>
74
+
75
+ <div className="wbtr:absolute wbtr:top-[2px] wbtr:left-2 wbtr:mb-1 wbtr:text-10 wbtr:opacity-50">
76
+ {__('Flexible Container', 'webentor')}
77
+ </div>
78
+
79
+ {children}
80
+ </div>
81
+ );
82
+ };
83
+
84
+ /**
85
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
86
+ *
87
+ * @return {null} Dynamic blocks do not save the HTML.
88
+ */
89
+ const BlockSave = () => <InnerBlocks.Content />;
90
+
91
+ /**
92
+ * Register block.
93
+ */
94
+ registerBlockType(block, {
95
+ edit: BlockEdit,
96
+ save: BlockSave,
97
+ });
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/l-footer",
5
+ "title": "Footer",
6
+ "description": "Footer block with various settings.",
7
+ "category": "webentor-layout",
8
+ "icon": "list-view",
9
+ "keywords": ["footer", "layout"],
10
+ "attributes": {
11
+ "sticky": {
12
+ "type": "string",
13
+ "default": ""
14
+ },
15
+ "hasContainer": {
16
+ "type": "boolean",
17
+ "default": true
18
+ }
19
+ },
20
+ "supports": {
21
+ "anchor": true
22
+ }
23
+ }
@@ -0,0 +1,51 @@
1
+ import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
2
+
3
+ import block from './block.json';
4
+
5
+ /**
6
+ * Edit component.
7
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
8
+ *
9
+ * @param {object} props The block props.
10
+ * @returns {Function} Render the edit screen
11
+ */
12
+
13
+ type AttributesType = {
14
+ coverImage: string;
15
+ sticky: string;
16
+ hasContainer: boolean;
17
+ };
18
+
19
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
20
+ const { attributes } = props;
21
+
22
+ // Preview image for block inserter
23
+ if (attributes.coverImage) {
24
+ return <img src={attributes.coverImage} width="468" />;
25
+ }
26
+
27
+ return (
28
+ <>
29
+ {/* Custom footer */}
30
+
31
+ <div className="footer wbtr:bg-gray-50 wbtr:p-5 wbtr:text-center">
32
+ Footer which will be displayed dynamically on FE
33
+ </div>
34
+ </>
35
+ );
36
+ };
37
+
38
+ /**
39
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
40
+ *
41
+ * @return {null} Dynamic blocks do not save the HTML.
42
+ */
43
+ const BlockSave = () => null;
44
+
45
+ /**
46
+ * Register block.
47
+ */
48
+ registerBlockType(block, {
49
+ edit: BlockEdit,
50
+ save: BlockSave,
51
+ });
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "name": "webentor/l-formatted-content",
4
+ "apiVersion": 3,
5
+ "title": "Formatted Content",
6
+ "description": "Use this block to wrap your content to apply formatting styles.",
7
+ "category": "webentor-layout",
8
+ "icon": "text-page",
9
+ "keywords": ["formatted", "content"],
10
+ "attributes": {
11
+ "anchor": {
12
+ "type": "string",
13
+ "default": ""
14
+ }
15
+ },
16
+ "supports": {
17
+ "anchor": true,
18
+ "color": {
19
+ "background": true,
20
+ "text": true
21
+ },
22
+ "webentor": {
23
+ "spacing": true,
24
+ "border": true,
25
+ "borderRadius": true
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,97 @@
1
+ import {
2
+ InnerBlocks,
3
+ useBlockProps,
4
+ useInnerBlocksProps,
5
+ } from '@wordpress/block-editor';
6
+ import {
7
+ BlockEditProps,
8
+ registerBlockType,
9
+ TemplateArray,
10
+ } from '@wordpress/blocks';
11
+ import { applyFilters } from '@wordpress/hooks';
12
+ import { __ } from '@wordpress/i18n';
13
+
14
+ import { useBlockParent } from '@webentorCore/blocks-utils/_use-block-parent';
15
+
16
+ import block from './block.json';
17
+
18
+ /**
19
+ * Edit component.
20
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
21
+ *
22
+ * @param {object} props The block props.
23
+ * @returns {Function} Render the edit screen
24
+ */
25
+
26
+ type AttributesType = {
27
+ coverImage: string;
28
+ template?: TemplateArray;
29
+ };
30
+
31
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
32
+ const { attributes } = props;
33
+
34
+ const blockProps = useBlockProps();
35
+ const parentBlockProps = useBlockParent();
36
+
37
+ /**
38
+ * Filter allowed blocks used in webentor/l-formatted-content inner block
39
+ */
40
+ const allowedBlocks: string[] = applyFilters(
41
+ 'webentor.core.l-formatted-content.allowedBlocks',
42
+ null,
43
+ blockProps,
44
+ parentBlockProps,
45
+ );
46
+
47
+ /**
48
+ * Filter template used in webentor/l-formatted-content inner block
49
+ */
50
+ const defaultTemplate: TemplateArray = attributes?.template ?? [];
51
+ const template: TemplateArray = applyFilters(
52
+ 'webentor.core.l-formatted-content.template',
53
+ defaultTemplate,
54
+ blockProps,
55
+ parentBlockProps,
56
+ );
57
+
58
+ const { children, ...innerBlocksProps } = useInnerBlocksProps(blockProps, {
59
+ allowedBlocks,
60
+ template,
61
+ });
62
+
63
+ // Preview image for block inserter
64
+ if (attributes.coverImage) {
65
+ return <img src={attributes.coverImage} width="468" />;
66
+ }
67
+
68
+ return (
69
+ <div
70
+ {...innerBlocksProps}
71
+ className={`${innerBlocksProps.className} format-content wbtr:relative wbtr:p-2 wbtr:pt-4`}
72
+ >
73
+ <div className="wbtr:pointer-events-none wbtr:absolute wbtr:inset-0 wbtr:h-full wbtr:w-full wbtr:border wbtr:border-dashed wbtr:border-editor-border wbtr:p-2 wbtr:pt-4"></div>
74
+
75
+ <div className="wbtr:absolute wbtr:top-[2px] wbtr:left-2 wbtr:mb-1 wbtr:text-10 wbtr:opacity-50">
76
+ {__('Formatted Content', 'webentor')}
77
+ </div>
78
+
79
+ {children}
80
+ </div>
81
+ );
82
+ };
83
+
84
+ /**
85
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
86
+ *
87
+ * @return {null} Dynamic blocks do not save the HTML.
88
+ */
89
+ const BlockSave = () => <InnerBlocks.Content />;
90
+
91
+ /**
92
+ * Register block.
93
+ */
94
+ registerBlockType(block, {
95
+ edit: BlockEdit,
96
+ save: BlockSave,
97
+ });
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "apiVersion": 3,
4
+ "name": "webentor/l-header",
5
+ "title": "Header",
6
+ "description": "Header block with various settings.",
7
+ "category": "webentor-layout",
8
+ "icon": "list-view",
9
+ "keywords": [
10
+ "header",
11
+ "layout"
12
+ ],
13
+ "attributes": {
14
+ "sticky": {
15
+ "type": "string",
16
+ "default": ""
17
+ },
18
+ "hasContainer": {
19
+ "type": "boolean",
20
+ "default": true
21
+ }
22
+ },
23
+ "supports": {
24
+ "anchor": true
25
+ }
26
+ }
@@ -0,0 +1,100 @@
1
+ // import {
2
+ // InspectorControls,
3
+ // useBlockProps,
4
+ // useInnerBlocksProps,
5
+ // } from '@wordpress/block-editor';
6
+ import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
7
+
8
+ import block from './block.json';
9
+
10
+ // import {
11
+ // PanelBody,
12
+ // PanelRow,
13
+ // SelectControl,
14
+ // ToggleControl,
15
+ // } from '@wordpress/components';
16
+ // import { __ } from '@wordpress/i18n';
17
+
18
+ /**
19
+ * Edit component.
20
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
21
+ *
22
+ * @param {object} props The block props.
23
+ * @returns {Function} Render the edit screen
24
+ */
25
+
26
+ type AttributesType = {
27
+ coverImage: string;
28
+ sticky: string;
29
+ hasContainer: boolean;
30
+ };
31
+
32
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
33
+ const { attributes } = props;
34
+
35
+ // const blockProps = useBlockProps();
36
+ // const innerBlocksProps = useInnerBlocksProps(blockProps, {});
37
+
38
+ // Preview image for block inserter
39
+ if (attributes.coverImage) {
40
+ return <img src={attributes.coverImage} width="468" />;
41
+ }
42
+
43
+ return (
44
+ <>
45
+ {/* <InspectorControls>
46
+ <PanelBody title="Block Settings" initialOpen={true}>
47
+ <PanelRow>
48
+ <SelectControl
49
+ label={__('Sticky type', 'webentor-blocks')}
50
+ value={attributes.sticky}
51
+ options={[
52
+ { label: __('Not sticky', 'webentor-blocks'), value: '' },
53
+ { label: __('Sticky', 'webentor-blocks'), value: 'sticky' },
54
+ {
55
+ label: __('Sticky w/ hide on scroll', 'webentor-blocks'),
56
+ value: 'sticky-hide-scroll',
57
+ },
58
+ ]}
59
+ onChange={(sticky) => setAttributes({ sticky })}
60
+ />
61
+ </PanelRow>
62
+
63
+ <PanelRow>
64
+ <ToggleControl
65
+ label={__('Has container?', 'webentor-blocks')}
66
+ checked={attributes.hasContainer}
67
+ onChange={(hasContainer) => setAttributes({ hasContainer })}
68
+ />
69
+ </PanelRow>
70
+ </PanelBody>
71
+ </InspectorControls>
72
+
73
+ <div
74
+ {...innerBlocksProps}
75
+ className={`${blockProps.className} ${innerBlocksProps.className} l-header border border-dashed border-editor-border p-2`}
76
+ /> */}
77
+
78
+ {/* Custom header */}
79
+
80
+ <div className="header wbtr:bg-gray-50 wbtr:p-5 wbtr:text-center">
81
+ Header which will be displayed dynamically on FE
82
+ </div>
83
+ </>
84
+ );
85
+ };
86
+
87
+ /**
88
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
89
+ *
90
+ * @return {null} Dynamic blocks do not save the HTML.
91
+ */
92
+ const BlockSave = () => null;
93
+
94
+ /**
95
+ * Register block.
96
+ */
97
+ registerBlockType(block, {
98
+ edit: BlockEdit,
99
+ save: BlockSave,
100
+ });
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "../../../schemas/webentor-block.json",
3
+ "name": "webentor/l-mobile-nav",
4
+ "title": "Mobile Navigation Wrapper",
5
+ "description": "Navigation menu block",
6
+ "category": "webentor-layout",
7
+ "icon": "menu",
8
+ "keywords": ["menu", "navigation", "mobile", "responsive", "hamburger"],
9
+ "attributes": {},
10
+ "supports": {
11
+ "webentor": {
12
+ "display": true
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,56 @@
1
+ import {
2
+ InnerBlocks,
3
+ useBlockProps,
4
+ useInnerBlocksProps,
5
+ } from '@wordpress/block-editor';
6
+ import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
7
+
8
+ import block from './block.json';
9
+
10
+ /**
11
+ * Edit component.
12
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
13
+ *
14
+ * @param {object} props The block props.
15
+ * @returns {Function} Render the edit screen
16
+ */
17
+
18
+ type AttributesType = {
19
+ coverImage: string;
20
+ };
21
+
22
+ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
23
+ const { attributes } = props;
24
+
25
+ const blockProps = useBlockProps();
26
+ const innerBlocksProps = useInnerBlocksProps(blockProps, {});
27
+
28
+ // Preview image for block inserter
29
+ if (attributes.coverImage) {
30
+ return <img src={attributes.coverImage} width="468" />;
31
+ }
32
+
33
+ return (
34
+ <>
35
+ <div
36
+ {...innerBlocksProps}
37
+ className={`${innerBlocksProps.className} wbtr:border wbtr:border-editor-border wbtr:p-4`}
38
+ />
39
+ </>
40
+ );
41
+ };
42
+
43
+ /**
44
+ * See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
45
+ *
46
+ * @return {null} Dynamic blocks do not save the HTML.
47
+ */
48
+ const BlockSave = () => <InnerBlocks.Content />;
49
+
50
+ /**
51
+ * Register block.
52
+ */
53
+ registerBlockType(block, {
54
+ edit: BlockEdit,
55
+ save: BlockSave,
56
+ });