FEATURE introducing hte block width variation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
92084f7826
commit
714bc5b3a1
|
|
@ -22,6 +22,14 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "full"
|
"default": "full"
|
||||||
},
|
},
|
||||||
|
"blockWidth": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "full",
|
||||||
|
"enum": [
|
||||||
|
"full",
|
||||||
|
"contained"
|
||||||
|
]
|
||||||
|
},
|
||||||
"coverUrl": {
|
"coverUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-primitives'), 'version' => '4148e87939fccf7f9ff3');
|
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-primitives'), 'version' => '62a57819a79c88fe5e2d');
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ const trash = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx
|
||||||
\************************/
|
\************************/
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/chapter-section","version":"0.1.0","title":" Section Chapitre","category":"carhop-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"carhop-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"align":{"type":"string","default":"full"},"coverUrl":{"type":"string"},"coverAlt":{"type":"string"},"coverId":{"type":"number"},"coverSize":{"type":"string","default":"large","enum":["small","medium","grande","large"]},"disposition":{"type":"string","default":"left","enum":["left","right"]},"hasBackgroundColor":{"type":"boolean","default":false},"backgroundColor":{"type":"string","default":"#ffffff"},"backgroundOrientation":{"type":"string","default":"left","enum":["left","right"]}},"usesContext":["postType","postId"]}');
|
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/chapter-section","version":"0.1.0","title":" Section Chapitre","category":"carhop-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"carhop-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"align":{"type":"string","default":"full"},"blockWidth":{"type":"string","default":"full","enum":["full","contained"]},"coverUrl":{"type":"string"},"coverAlt":{"type":"string"},"coverId":{"type":"number"},"coverSize":{"type":"string","default":"large","enum":["small","medium","grande","large"]},"disposition":{"type":"string","default":"left","enum":["left","right"]},"hasBackgroundColor":{"type":"boolean","default":false},"backgroundColor":{"type":"string","default":"#ffffff"},"backgroundOrientation":{"type":"string","default":"left","enum":["left","right"]}},"usesContext":["postType","postId"]}');
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
|
@ -86,7 +86,8 @@ function Edit({
|
||||||
coverSize,
|
coverSize,
|
||||||
hasBackgroundColor,
|
hasBackgroundColor,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
backgroundOrientation
|
backgroundOrientation,
|
||||||
|
blockWidth
|
||||||
} = attributes;
|
} = attributes;
|
||||||
function onDispositionChange(disposition) {
|
function onDispositionChange(disposition) {
|
||||||
setAttributes({
|
setAttributes({
|
||||||
|
|
@ -134,7 +135,26 @@ function Edit({
|
||||||
}
|
}
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
|
||||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
|
||||||
|
className: "deligraph-blocks-components-image__panel-body",
|
||||||
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Largeur", "deligraph-blocks"),
|
||||||
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, {
|
||||||
|
className: "deligraph-blocks__variant",
|
||||||
|
isBlock: true,
|
||||||
|
label: "Largeur du bloc",
|
||||||
|
onChange: value => setAttributes({
|
||||||
|
blockWidth: value
|
||||||
|
}),
|
||||||
|
value: blockWidth,
|
||||||
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, {
|
||||||
|
label: "Contenue",
|
||||||
|
value: "contained"
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, {
|
||||||
|
label: "Pleine largeur",
|
||||||
|
value: "full"
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
|
||||||
className: "deligraph-blocks-components-image__panel-body",
|
className: "deligraph-blocks-components-image__panel-body",
|
||||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Image d'accompagnement", "deligraph-blocks"),
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Image d'accompagnement", "deligraph-blocks"),
|
||||||
children: [coverUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {
|
children: [coverUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {
|
||||||
|
|
@ -221,7 +241,9 @@ function Edit({
|
||||||
})]
|
})]
|
||||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("section", {
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("section", {
|
||||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
|
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
|
||||||
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition} ${hasBackgroundColor && backgroundColor ? "chapter-section--has-background" : ""}`
|
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition}
|
||||||
|
${blockWidth === "full" ? "chapter-section--width-full" : "chapter-section--width-contained"}
|
||||||
|
${hasBackgroundColor && backgroundColor ? "chapter-section--has-background" : ""}`
|
||||||
}),
|
}),
|
||||||
children: [hasBackgroundColor && backgroundColor && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("svg", {
|
children: [hasBackgroundColor && backgroundColor && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("svg", {
|
||||||
className: `chapter-section__background chapter-section__background--${backgroundOrientation}`,
|
className: `chapter-section__background chapter-section__background--${backgroundOrientation}`,
|
||||||
|
|
@ -343,11 +365,12 @@ function save({
|
||||||
coverSize,
|
coverSize,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
hasBackgroundColor,
|
hasBackgroundColor,
|
||||||
backgroundOrientation
|
backgroundOrientation,
|
||||||
|
blockWidth
|
||||||
} = attributes;
|
} = attributes;
|
||||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("section", {
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("section", {
|
||||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save({
|
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save({
|
||||||
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition} ${backgroundColor ? "chapter-section--has-background" : ""}`
|
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition} ${backgroundColor ? "chapter-section--has-background" : ""} ${blockWidth === "full" ? "chapter-section--width-full" : "chapter-section--width-contained"}`
|
||||||
}),
|
}),
|
||||||
children: [hasBackgroundColor && backgroundColor && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg", {
|
children: [hasBackgroundColor && backgroundColor && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg", {
|
||||||
className: `chapter-section__background chapter-section__background--${backgroundOrientation}`,
|
className: `chapter-section__background chapter-section__background--${backgroundOrientation}`,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -22,6 +22,14 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "full"
|
"default": "full"
|
||||||
},
|
},
|
||||||
|
"blockWidth": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "full",
|
||||||
|
"enum": [
|
||||||
|
"full",
|
||||||
|
"contained"
|
||||||
|
]
|
||||||
|
},
|
||||||
"coverUrl": {
|
"coverUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export default function Edit({ attributes, setAttributes, ...props }) {
|
||||||
hasBackgroundColor,
|
hasBackgroundColor,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
backgroundOrientation,
|
backgroundOrientation,
|
||||||
|
blockWidth,
|
||||||
} = attributes;
|
} = attributes;
|
||||||
|
|
||||||
function onDispositionChange(disposition) {
|
function onDispositionChange(disposition) {
|
||||||
|
|
@ -68,6 +69,21 @@ export default function Edit({ attributes, setAttributes, ...props }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<InspectorControls>
|
<InspectorControls>
|
||||||
|
<PanelBody
|
||||||
|
className="deligraph-blocks-components-image__panel-body"
|
||||||
|
title={__("Largeur", "deligraph-blocks")}
|
||||||
|
>
|
||||||
|
<ToggleGroupControl
|
||||||
|
className="deligraph-blocks__variant"
|
||||||
|
isBlock
|
||||||
|
label="Largeur du bloc"
|
||||||
|
onChange={(value) => setAttributes({ blockWidth: value })}
|
||||||
|
value={blockWidth}
|
||||||
|
>
|
||||||
|
<ToggleGroupControlOption label="Contenue" value="contained" />
|
||||||
|
<ToggleGroupControlOption label="Pleine largeur" value="full" />
|
||||||
|
</ToggleGroupControl>
|
||||||
|
</PanelBody>
|
||||||
<PanelBody
|
<PanelBody
|
||||||
className="deligraph-blocks-components-image__panel-body"
|
className="deligraph-blocks-components-image__panel-body"
|
||||||
title={__("Image d'accompagnement", "deligraph-blocks")}
|
title={__("Image d'accompagnement", "deligraph-blocks")}
|
||||||
|
|
@ -122,6 +138,7 @@ export default function Edit({ attributes, setAttributes, ...props }) {
|
||||||
<ToggleGroupControlOption label="Petite" value="small" />
|
<ToggleGroupControlOption label="Petite" value="small" />
|
||||||
</ToggleGroupControl>
|
</ToggleGroupControl>
|
||||||
</PanelBody>
|
</PanelBody>
|
||||||
|
|
||||||
<PanelBody
|
<PanelBody
|
||||||
className="deligraph-blocks-components-image__panel-body"
|
className="deligraph-blocks-components-image__panel-body"
|
||||||
title={__("Arrière plan", "deligraph-blocks")}
|
title={__("Arrière plan", "deligraph-blocks")}
|
||||||
|
|
@ -154,7 +171,13 @@ export default function Edit({ attributes, setAttributes, ...props }) {
|
||||||
</InspectorControls>
|
</InspectorControls>
|
||||||
<section
|
<section
|
||||||
{...useBlockProps({
|
{...useBlockProps({
|
||||||
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition} ${
|
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition}
|
||||||
|
${
|
||||||
|
blockWidth === "full"
|
||||||
|
? "chapter-section--width-full"
|
||||||
|
: "chapter-section--width-contained"
|
||||||
|
}
|
||||||
|
${
|
||||||
hasBackgroundColor && backgroundColor
|
hasBackgroundColor && backgroundColor
|
||||||
? "chapter-section--has-background"
|
? "chapter-section--has-background"
|
||||||
: ""
|
: ""
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,17 @@ export default function save({ attributes }) {
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
hasBackgroundColor,
|
hasBackgroundColor,
|
||||||
backgroundOrientation,
|
backgroundOrientation,
|
||||||
|
blockWidth,
|
||||||
} = attributes;
|
} = attributes;
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
{...useBlockProps.save({
|
{...useBlockProps.save({
|
||||||
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition} ${
|
className: `deligraph-blocks-chapter-section chapter-section chapter-section--${disposition} ${
|
||||||
backgroundColor ? "chapter-section--has-background" : ""
|
backgroundColor ? "chapter-section--has-background" : ""
|
||||||
|
} ${
|
||||||
|
blockWidth === "full"
|
||||||
|
? "chapter-section--width-full"
|
||||||
|
: "chapter-section--width-contained"
|
||||||
}`,
|
}`,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user