@40q/40q-cli 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
package/.cliroot
ADDED
File without changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@40q/40q-cli",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.8",
|
4
4
|
"description": "40q CLI tool",
|
5
5
|
"main": "index.js",
|
6
6
|
"bin": {
|
@@ -28,6 +28,8 @@
|
|
28
28
|
"typescript": "^5.2.2"
|
29
29
|
},
|
30
30
|
"files": [
|
31
|
-
"dist/"
|
31
|
+
"dist/",
|
32
|
+
"templates/",
|
33
|
+
".cliroot"
|
32
34
|
]
|
33
35
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Blocks;
|
4
|
+
|
5
|
+
use BlockHandler\Contracts\BlockHandler;
|
6
|
+
|
7
|
+
class {{camelCaseName}} extends BlockHandler
|
8
|
+
{
|
9
|
+
public function __invoke($block_content, $block)
|
10
|
+
{
|
11
|
+
return view('blocks.{{name}}', [
|
12
|
+
'title' => $block['attrs']['title'] ?? null,
|
13
|
+
]);
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
2
|
+
import { PanelBody } from "@wordpress/components";
|
3
|
+
import {
|
4
|
+
InspectorControls,
|
5
|
+
RichText,
|
6
|
+
useBlockProps,
|
7
|
+
} from "@wordpress/block-editor";
|
8
|
+
|
9
|
+
/* Block name */
|
10
|
+
export const name = "by40q/{{name}}";
|
11
|
+
|
12
|
+
/* Block title */
|
13
|
+
export const title = __("{{title}}", "40q");
|
14
|
+
|
15
|
+
/* Block category */
|
16
|
+
export const category = "text";
|
17
|
+
|
18
|
+
/* Block attributes */
|
19
|
+
export const attributes = {
|
20
|
+
title: {
|
21
|
+
type: "string",
|
22
|
+
default: "40Q",
|
23
|
+
},
|
24
|
+
};
|
25
|
+
|
26
|
+
/* Block edit */
|
27
|
+
export const edit = ({ attributes, setAttributes }) => {
|
28
|
+
const { title } = attributes;
|
29
|
+
|
30
|
+
const blockProps = useBlockProps();
|
31
|
+
|
32
|
+
return (
|
33
|
+
<>
|
34
|
+
<InspectorControls>
|
35
|
+
<PanelBody title={__("{{title}} Settings")} initialOpen></PanelBody>
|
36
|
+
</InspectorControls>
|
37
|
+
|
38
|
+
<div {...blockProps}>
|
39
|
+
<RichText
|
40
|
+
tagName="h2"
|
41
|
+
placeholder={__("40Q")}
|
42
|
+
value={title}
|
43
|
+
onChange={(title) => setAttributes({ title })}
|
44
|
+
/>
|
45
|
+
</div>
|
46
|
+
</>
|
47
|
+
);
|
48
|
+
};
|
49
|
+
|
50
|
+
/* Block save */
|
51
|
+
export const save = () => <></>;
|
52
|
+
|
53
|
+
/* Block styles */
|
54
|
+
export const styles = [];
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Blocks;
|
4
|
+
|
5
|
+
use BlockHandler\Contracts\BlockHandler;
|
6
|
+
|
7
|
+
class {{camelCaseName}} extends BlockHandler
|
8
|
+
{
|
9
|
+
public function __invoke($block_content, $block)
|
10
|
+
{
|
11
|
+
return view('blocks.{{name}}', [
|
12
|
+
'eyebrow' => $block['attrs']['eyebrow'] ?? null,
|
13
|
+
'title' => $block['attrs']['title'] ?? null,
|
14
|
+
'description' => $block['attrs']['description'] ?? null,
|
15
|
+
]);
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
2
|
+
import { PanelBody, ToggleControl } from "@wordpress/components";
|
3
|
+
import {
|
4
|
+
InspectorControls,
|
5
|
+
RichText,
|
6
|
+
useBlockProps,
|
7
|
+
useInnerBlocksProps,
|
8
|
+
} from "@wordpress/block-editor";
|
9
|
+
|
10
|
+
/* Block name */
|
11
|
+
export const name = "by40q/{{name}}";
|
12
|
+
|
13
|
+
/* Block title */
|
14
|
+
export const title = __("{{title}}", "40q");
|
15
|
+
|
16
|
+
/* Block category */
|
17
|
+
export const category = "text";
|
18
|
+
|
19
|
+
/* Block attributes */
|
20
|
+
export const attributes = {
|
21
|
+
showEyebrow: {
|
22
|
+
type: "boolean",
|
23
|
+
default: true,
|
24
|
+
},
|
25
|
+
eyebrow: {
|
26
|
+
type: "string",
|
27
|
+
default: "Introducing",
|
28
|
+
},
|
29
|
+
title: {
|
30
|
+
type: "string",
|
31
|
+
default: "40Q",
|
32
|
+
},
|
33
|
+
showDescription: {
|
34
|
+
type: "boolean",
|
35
|
+
default: true,
|
36
|
+
},
|
37
|
+
description: {
|
38
|
+
type: "string",
|
39
|
+
default:
|
40
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, diam id tincidunt ultrices, nunc nisl ultrices nunc, vitae aliquam nisl nunc eu nisl. Sed euismod, diam id tincidunt ultrices, nunc nisl ultrices nunc, vitae aliquam nisl nunc eu nisl.",
|
41
|
+
},
|
42
|
+
showCta: {
|
43
|
+
type: "boolean",
|
44
|
+
default: false,
|
45
|
+
},
|
46
|
+
};
|
47
|
+
|
48
|
+
/* Block edit */
|
49
|
+
export const edit = ({ attributes, setAttributes }) => {
|
50
|
+
const { showEyeBrow, eyebrow, title, showDescription, description, showCta } =
|
51
|
+
attributes;
|
52
|
+
|
53
|
+
const blockProps = useBlockProps();
|
54
|
+
|
55
|
+
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
56
|
+
template: [["core/button"]],
|
57
|
+
allowedBlocks: [],
|
58
|
+
templateLock: "all",
|
59
|
+
});
|
60
|
+
|
61
|
+
return (
|
62
|
+
<>
|
63
|
+
<InspectorControls>
|
64
|
+
<PanelBody title={__("Section Header Settings")} initialOpen>
|
65
|
+
<ToggleControl
|
66
|
+
label="Eyebrow"
|
67
|
+
checked={!!showEyeBrow}
|
68
|
+
onChange={(showEyeBrow) => setAttributes({ showEyeBrow })}
|
69
|
+
/>
|
70
|
+
<ToggleControl
|
71
|
+
label="Description"
|
72
|
+
checked={!!showDescription}
|
73
|
+
onChange={(showDescription) => setAttributes({ showDescription })}
|
74
|
+
/>
|
75
|
+
|
76
|
+
<ToggleControl
|
77
|
+
label="Cta"
|
78
|
+
checked={!!showCta}
|
79
|
+
onChange={(showCta) => setAttributes({ showCta })}
|
80
|
+
/>
|
81
|
+
</PanelBody>
|
82
|
+
</InspectorControls>
|
83
|
+
|
84
|
+
<div {...blockProps}>
|
85
|
+
{!!showEyeBrow && (
|
86
|
+
<RichText
|
87
|
+
className=""
|
88
|
+
tagName="p"
|
89
|
+
placeholder={__("Eyebrow")}
|
90
|
+
value={eyebrow}
|
91
|
+
onChange={(eyebrow) => setAttributes({ eyebrow })}
|
92
|
+
/>
|
93
|
+
)}
|
94
|
+
<RichText
|
95
|
+
className=""
|
96
|
+
tagName="h2"
|
97
|
+
placeholder={__("40Q")}
|
98
|
+
value={title}
|
99
|
+
onChange={(title) => setAttributes({ title })}
|
100
|
+
/>
|
101
|
+
{!!showDescription && (
|
102
|
+
<RichText
|
103
|
+
className=""
|
104
|
+
tagName="p"
|
105
|
+
placeholder={__("Lorem ipsum dolor sit amet.")}
|
106
|
+
value={description}
|
107
|
+
onChange={(description) => setAttributes({ description })}
|
108
|
+
/>
|
109
|
+
)}
|
110
|
+
{!!showCta && <div {...innerBlocksProps} />}
|
111
|
+
</div>
|
112
|
+
</>
|
113
|
+
);
|
114
|
+
};
|
115
|
+
|
116
|
+
/* Block save */
|
117
|
+
export const save = <></>;
|
118
|
+
|
119
|
+
/* Block styles */
|
120
|
+
export const styles = [];
|