refining editor js for arrays shortcode + refining plus loin
This commit is contained in:
parent
e36e9fdd51
commit
d896c68603
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '90d4bc9cf614ad8ee3ac');
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '22279f01bc9b3f5d72ab');
|
||||
|
|
|
|||
|
|
@ -89,7 +89,9 @@ function Edit({
|
|||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({
|
||||
className: `homegrade-blocks-focus-point-caption`
|
||||
})
|
||||
}, focusCaptionDescription));
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
|
||||
className: "focus-point-title"
|
||||
}, focusTitle), focusCaptionDescription));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -166,13 +168,16 @@ function save({
|
|||
attributes
|
||||
}) {
|
||||
const {
|
||||
focusCaptionDescription
|
||||
focusCaptionDescription,
|
||||
focusTitle
|
||||
} = attributes;
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("li", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
className: `homegrade-blocks-focus-point-caption`
|
||||
})
|
||||
}, focusCaptionDescription);
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
|
||||
className: "focus-point-title"
|
||||
}, focusTitle), focusCaptionDescription);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'a7ab9ce50d3cfb82e362');
|
||||
<?php return array('dependencies' => array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'e399c1d468ef3b9886c2');
|
||||
|
|
|
|||
|
|
@ -308,7 +308,9 @@ function Edit({
|
|||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({
|
||||
className: `homegrade-blocks-focus-point-caption`
|
||||
})
|
||||
}, focusCaptionDescription));
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
|
||||
className: "focus-point-title"
|
||||
}, focusTitle), focusCaptionDescription));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -385,13 +387,16 @@ function save({
|
|||
attributes
|
||||
}) {
|
||||
const {
|
||||
focusCaptionDescription
|
||||
focusCaptionDescription,
|
||||
focusTitle
|
||||
} = attributes;
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("li", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
className: `homegrade-blocks-focus-point-caption`
|
||||
})
|
||||
}, focusCaptionDescription);
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
|
||||
className: "focus-point-title"
|
||||
}, focusTitle), focusCaptionDescription);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -103,4 +103,9 @@
|
|||
min-width: 100px;
|
||||
}
|
||||
|
||||
.focus-point-title {
|
||||
font-weight: bold;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=style-index.css.map*/
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF;AAIE;EACC;EACA;AAFH;AAIG;EACC;EACA;EACA;EACA;AAFJ;AAIG;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAFJ,C;;;;ACpCA;;;;;EAAA;AAMA;EACC;EACA;AACD;;AAGC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAF;;AAIA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AADD;AAIC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAFF;AAIC;EACC;EACA;AAFF,C","sources":["webpack://multiblocks/./src/style.scss","webpack://multiblocks/./src/focus-point/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.homegrade-blocks-focused-schema {\n\tfigure {\n\t\tposition: relative;\n\t}\n\tfigcaption {\n\t\tol {\n\t\t\tpadding-top: 20px;\n\t\t\tcounter-reset: myOrderedListItemsCounter;\n\n\t\t\tli {\n\t\t\t\tlist-style-type: none;\n\t\t\t\tposition: relative;\n\t\t\t\tpadding: 8px;\n\t\t\t\tpadding-left: 50px;\n\t\t\t}\n\t\t\tli:before {\n\t\t\t\tleft: 0;\n\t\t\t\ttop: 0;\n\t\t\t\ttransform: translateY(3px);\n\t\t\t\tposition: absolute;\n\t\t\t\twidth: 30px;\n\t\t\t\theight: 30px;\n\t\t\t\tdisplay: flex;\n\t\t\t\tjustify-content: center;\n\t\t\t\talign-items: center;\n\t\t\t\tbackground-color: red;\n\t\t\t\tcolor: white;\n\t\t\t\tborder-radius: 50%;\n\t\t\t\tcounter-increment: myOrderedListItemsCounter;\n\t\t\t\tcontent: counter(myOrderedListItemsCounter);\n\t\t\t\tmargin-right: 0.5em;\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n.homegrade-blocks-focus-point-bullet:hover {\n\tscale: 1.2;\n\tfilter: brightness(1.2) hue-rotate(10deg);\n}\n\n.homegrade-blocks-focus-point-bullet {\n\t&__index {\n\t\tborder-radius: 50%;\n\t\tfont-weight: 700;\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tposition: absolute !important;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tposition: relative;\n\t\tcolor: white;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tpadding: 16px;\n\t\ttransition: scale 0.2s ease-in-out;\n\t\tz-index: 1;\n\t\t// display: none;\n\t}\n}\n.focus-point-popup-container {\n\tbackground-color: white;\n\topacity: 0.9999;\n\tborder-radius: 14px;\n\tpadding: 10px;\n\ttransform: translate(-34%, -110%);\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tmax-width: 400px;\n\ttext-align: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);\n\t// z-index: 99;\n\n\t&:after {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tbackground-color: white;\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\twidth: 10px;\n\t\theight: 10px;\n\t\ttransform: translate(-50%, -50%) rotate(45deg);\n\t\tbox-shadow: 4px 4px 4px rgba(0, 0, 0, 0.04);\n\t}\n\t&__title {\n\t\twidth: auto;\n\t\tmin-width: 100px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF;AAIE;EACC;EACA;AAFH;AAIG;EACC;EACA;EACA;EACA;AAFJ;AAIG;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAFJ,C;;;;ACpCA;;;;;EAAA;AAMA;EACC;EACA;AACD;;AAGC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAF;;AAIA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AADD;AAIC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAFF;AAIC;EACC;EACA;AAFF;;AAMA;EACC;EACA;AAHD,C","sources":["webpack://multiblocks/./src/style.scss","webpack://multiblocks/./src/focus-point/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.homegrade-blocks-focused-schema {\n\tfigure {\n\t\tposition: relative;\n\t}\n\tfigcaption {\n\t\tol {\n\t\t\tpadding-top: 20px;\n\t\t\tcounter-reset: myOrderedListItemsCounter;\n\n\t\t\tli {\n\t\t\t\tlist-style-type: none;\n\t\t\t\tposition: relative;\n\t\t\t\tpadding: 8px;\n\t\t\t\tpadding-left: 50px;\n\t\t\t}\n\t\t\tli:before {\n\t\t\t\tleft: 0;\n\t\t\t\ttop: 0;\n\t\t\t\ttransform: translateY(3px);\n\t\t\t\tposition: absolute;\n\t\t\t\twidth: 30px;\n\t\t\t\theight: 30px;\n\t\t\t\tdisplay: flex;\n\t\t\t\tjustify-content: center;\n\t\t\t\talign-items: center;\n\t\t\t\tbackground-color: red;\n\t\t\t\tcolor: white;\n\t\t\t\tborder-radius: 50%;\n\t\t\t\tcounter-increment: myOrderedListItemsCounter;\n\t\t\t\tcontent: counter(myOrderedListItemsCounter);\n\t\t\t\tmargin-right: 0.5em;\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n.homegrade-blocks-focus-point-bullet:hover {\n\tscale: 1.2;\n\tfilter: brightness(1.2) hue-rotate(10deg);\n}\n\n.homegrade-blocks-focus-point-bullet {\n\t&__index {\n\t\tborder-radius: 50%;\n\t\tfont-weight: 700;\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tposition: absolute !important;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tposition: relative;\n\t\tcolor: white;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tpadding: 16px;\n\t\ttransition: scale 0.2s ease-in-out;\n\t\tz-index: 1;\n\t\t// display: none;\n\t}\n}\n.focus-point-popup-container {\n\tbackground-color: white;\n\topacity: 0.9999;\n\tborder-radius: 14px;\n\tpadding: 10px;\n\ttransform: translate(-34%, -110%);\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tmax-width: 400px;\n\ttext-align: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);\n\t// z-index: 99;\n\n\t&:after {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tbackground-color: white;\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\twidth: 10px;\n\t\theight: 10px;\n\t\ttransform: translate(-50%, -50%) rotate(45deg);\n\t\tbox-shadow: 4px 4px 4px rgba(0, 0, 0, 0.04);\n\t}\n\t&__title {\n\t\twidth: auto;\n\t\tmin-width: 100px;\n\t}\n}\n\n.focus-point-title {\n\tfont-weight: bold;\n\tmargin-right: 6px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -79,6 +79,7 @@ export default function Edit({
|
|||
className: `homegrade-blocks-focus-point-caption`,
|
||||
})}
|
||||
>
|
||||
<span className="focus-point-title">{focusTitle}</span>
|
||||
{focusCaptionDescription}
|
||||
</li>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
|
||||
|
||||
export default function save({ attributes }) {
|
||||
const { focusCaptionDescription } = attributes;
|
||||
const { focusCaptionDescription, focusTitle } = attributes;
|
||||
return (
|
||||
<li
|
||||
{...useBlockProps.save({
|
||||
className: `homegrade-blocks-focus-point-caption`,
|
||||
})}
|
||||
>
|
||||
<span className="focus-point-title">{focusTitle}</span>
|
||||
{focusCaptionDescription}
|
||||
</li>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -63,3 +63,8 @@
|
|||
min-width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.focus-point-title {
|
||||
font-weight: bold;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'd1752e8f3a4f050f9e8a');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '897bb52e9c98ac1d2b8a');
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z"
|
||||
d: "M21,7H3V4A1,1,0,0,1,4,3H20a1,1,0,0,1,1,1ZM3,20V9H21V20a1,1,0,0,1-1,1H4A1,1,0,0,1,3,20Zm3-6H18V12H6Zm0,4h6V16H6Z"
|
||||
})),
|
||||
foreground: "#DF1E1E"
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,11 +7,10 @@ import save from "./save";
|
|||
import metadata from "./block.json";
|
||||
|
||||
registerBlockType(metadata.name, {
|
||||
|
||||
icon: {
|
||||
src: (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z" />
|
||||
<path d="M21,7H3V4A1,1,0,0,1,4,3H20a1,1,0,0,1,1,1ZM3,20V9H21V20a1,1,0,0,1-1,1H4A1,1,0,0,1,3,20Zm3-6H18V12H6Zm0,4h6V16H6Z" />
|
||||
</svg>
|
||||
),
|
||||
foreground: "#DF1E1E",
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
// $attributes = get_block_attributes();
|
||||
// echo '<pre>';
|
||||
// print_r($block);
|
||||
// echo '</pre>';
|
||||
|
||||
$inner_blocks_html = '';
|
||||
foreach ($block->inner_blocks as $inner_block) {
|
||||
$inner_blocks_html .= $inner_block->render();
|
||||
}
|
||||
?>
|
||||
<section class="homegrade-blocks-highlight">
|
||||
<div class="homegrade-blocks-highlight__titling">
|
||||
<div class="icon">
|
||||
<img src="<?php echo plugin_dir_url(dirname(__DIR__)) ?>src/points-cles/img/icon_feather_key.png" alt="" />
|
||||
</div>
|
||||
<h3 class=""><?php echo __("Les points clés", "homegrade-theme__blocks-texte-fonctionnel") ?></h3>
|
||||
</div>
|
||||
<?php echo $inner_blocks_html ?>
|
||||
|
||||
|
||||
</section>
|
||||
|
|
@ -1,31 +1,17 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/highlight",
|
||||
"name": "homegrade-content-blocks/plus-loin",
|
||||
"version": "0.1.0",
|
||||
"title": "Mise en avant",
|
||||
"title": "Plus loin",
|
||||
"category": "homegrade-blocks",
|
||||
"description": "Bloc pour mettre en avant des informations importantes",
|
||||
"description": "Bloc pour mettre en avant des informations pour aller plus loin",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "homegrade-blocks__texte-fonctionnel",
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "h3"
|
||||
},
|
||||
"iconName": {
|
||||
"type": "string",
|
||||
"default": "key"
|
||||
},
|
||||
"hasTitle": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
"attributes": {}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'd1752e8f3a4f050f9e8a');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'fe952a286855e36858c7');
|
||||
|
|
|
|||
|
|
@ -6,19 +6,8 @@
|
|||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.homegrade-blocks-highlight ul li {
|
||||
display: flex;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.homegrade-blocks-highlight ul li:before {
|
||||
transform: translateY(6px);
|
||||
flex-shrink: 0;
|
||||
border-radius: 50%;
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
.wp-block-create-block-multiblocks {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=index.css.map*/
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAQE;EAEC;EACA;AAHH;AAKE;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAHH,C","sources":["webpack://multiblocks/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.homegrade-blocks-highlight {\n\tul {\n\t\tli {\n\t\t\t// list-style: none !important;\n\t\t\tdisplay: flex;\n\t\t\tpadding: 10px 0;\n\t\t}\n\t\tli:before {\n\t\t\ttransform: translateY(6px);\n\t\t\tflex-shrink: 0;\n\t\t\tborder-radius: 50%;\n\t\t\tcontent: \"\";\n\t\t\twidth: 10px;\n\t\t\theight: 10px;\n\t\t\tdisplay: inline-block;\n\t\t\tmargin-right: 10px;\n\t\t}\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://multiblocks/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-create-block-multiblocks {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -196,97 +196,14 @@ function Edit({
|
|||
attributes,
|
||||
setAttributes
|
||||
}) {
|
||||
const {
|
||||
title,
|
||||
iconName,
|
||||
hasTitle
|
||||
} = attributes;
|
||||
const handleIconChange = newIconName => {
|
||||
setAttributes({
|
||||
iconName: newIconName
|
||||
});
|
||||
};
|
||||
function getIconPicture() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
return _img_icon_feather_key_svg__WEBPACK_IMPORTED_MODULE_3__["default"];
|
||||
case "chain":
|
||||
return _img_icon_block_chain_svg__WEBPACK_IMPORTED_MODULE_4__["default"];
|
||||
case "house":
|
||||
return _img_icon_house_svg__WEBPACK_IMPORTED_MODULE_5__["default"];
|
||||
case "bulb":
|
||||
return _img_icon_bulb_svg__WEBPACK_IMPORTED_MODULE_6__["default"];
|
||||
}
|
||||
}
|
||||
function getDashiconSymbol() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
return "admin-network";
|
||||
case "chain":
|
||||
return "admin-links";
|
||||
case "house":
|
||||
return "admin-home";
|
||||
case "bulb":
|
||||
return "lightbulb";
|
||||
}
|
||||
}
|
||||
function onHasTitleChange() {
|
||||
setAttributes({
|
||||
hasTitle: !hasTitle,
|
||||
title: undefined
|
||||
});
|
||||
}
|
||||
let iconPicture = getIconPicture();
|
||||
let iconDashiconSymbol = getDashiconSymbol();
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, {
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre", "homegrade-blocks__texte-fonctionnel"),
|
||||
initialOpen: true
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToggleControl, {
|
||||
label: "Afficher le titre",
|
||||
checked: hasTitle,
|
||||
onChange: onHasTitleChange
|
||||
}))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Clé",
|
||||
icon: "admin-network",
|
||||
isActive: iconName === "key",
|
||||
onClick: () => handleIconChange("key")
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Lien",
|
||||
icon: "admin-links",
|
||||
isActive: iconName === "chain",
|
||||
onClick: () => handleIconChange("chain")
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Homegrade",
|
||||
icon: "admin-home",
|
||||
isActive: iconName === "house",
|
||||
onClick: () => handleIconChange("house")
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Inspiration",
|
||||
icon: "lightbulb",
|
||||
isActive: iconName === "bulb",
|
||||
onClick: () => handleIconChange("bulb")
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.useBlockProps)({
|
||||
className: `homegrade-blocks-highlight`
|
||||
className: `homegrade-blocks-plus-loin`
|
||||
})
|
||||
}, hasTitle && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "homegrade-blocks-highlight__titling"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "icon"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
src: iconPicture,
|
||||
alt: ""
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.RichText, {
|
||||
className: "homegrade-blocks-highlight__block-title",
|
||||
onChange: value => setAttributes({
|
||||
title: value
|
||||
}),
|
||||
value: title,
|
||||
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Insérez un titre", "homegrade-blocks__texte-fonctionnel"),
|
||||
tagName: "h3",
|
||||
allowedFormats: []
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.InnerBlocks, {
|
||||
allowedBlocks: ["core/paragraph", "core/list", "core/buttons", "core/button", "core/colums", "core/colum", "homegrade-content-blocks/content-heading"],
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", {
|
||||
className: "homegrade-blocks-plus-loin__block-title"
|
||||
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Pour aller plus loin", "homegrade-blocks__texte-fonctionnel")), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.InnerBlocks, {
|
||||
allowedBlocks: ["core/paragraph", "homegrade-blocks/content-heading", "core/list", "core/buttons", "core/button", "core/colums", "core/colum", "homegrade-content-blocks/content-heading"],
|
||||
template: [["core/paragraph"]]
|
||||
})));
|
||||
}
|
||||
|
|
@ -304,31 +221,28 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
|
||||
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
|
||||
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
|
||||
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./save */ "./src/save.js");
|
||||
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
|
||||
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
|
||||
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
|
||||
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./save */ "./src/save.js");
|
||||
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_6__.name, {
|
||||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_5__.name, {
|
||||
icon: {
|
||||
src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z"
|
||||
d: "M12,22A17.5,17.5,0,0,0,21,6.7V6L12,2,3,6v.7A17.5,17.5,0,0,0,12,22ZM11,6h2V8H11Zm0,4h2v8H11Z"
|
||||
})),
|
||||
foreground: "#DF1E1E"
|
||||
},
|
||||
edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"],
|
||||
save: _save__WEBPACK_IMPORTED_MODULE_5__["default"]
|
||||
edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"],
|
||||
save: _save__WEBPACK_IMPORTED_MODULE_4__["default"]
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -349,17 +263,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _img_icon_feather_key_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./img/icon_feather_key.svg */ "./src/img/icon_feather_key.svg");
|
||||
/* harmony import */ var _img_icon_block_chain_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./img/icon_block_chain.svg */ "./src/img/icon_block_chain.svg");
|
||||
/* harmony import */ var _img_icon_house_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./img/icon_house.svg */ "./src/img/icon_house.svg");
|
||||
/* harmony import */ var _img_icon_bulb_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./img/icon_bulb.svg */ "./src/img/icon_bulb.svg");
|
||||
|
||||
|
||||
|
||||
// pour les querry
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -367,41 +270,13 @@ function save({
|
|||
attributes,
|
||||
setAttributes
|
||||
}) {
|
||||
const {
|
||||
title,
|
||||
iconName,
|
||||
hasTitle
|
||||
} = attributes;
|
||||
function getIconPicture() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
return _img_icon_feather_key_svg__WEBPACK_IMPORTED_MODULE_4__["default"];
|
||||
case "chain":
|
||||
return _img_icon_block_chain_svg__WEBPACK_IMPORTED_MODULE_5__["default"];
|
||||
case "house":
|
||||
return _img_icon_house_svg__WEBPACK_IMPORTED_MODULE_6__["default"];
|
||||
case "bulb":
|
||||
return _img_icon_bulb_svg__WEBPACK_IMPORTED_MODULE_7__["default"];
|
||||
}
|
||||
}
|
||||
let iconPicture = getIconPicture();
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
className: `homegrade-blocks-highlight`
|
||||
className: `homegrade-blocks-plus-loin`
|
||||
})
|
||||
}, hasTitle && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "homegrade-blocks-highlight__titling"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "icon"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
clas: true,
|
||||
src: iconPicture,
|
||||
alt: ""
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||
tagName: "h3",
|
||||
value: title,
|
||||
className: "homegrade-blocks-highlight__block-title"
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null));
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h2", {
|
||||
className: "homegrade-blocks-plus-loin__block-title"
|
||||
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Pour aller plus loin", "homegrade-blocks__texte-fonctionnel")), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -470,16 +345,6 @@ module.exports = window["wp"]["components"];
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/data":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","data"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["data"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/element":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","element"] ***!
|
||||
|
|
@ -506,7 +371,7 @@ module.exports = window["wp"]["i18n"];
|
|||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/highlight","version":"0.1.0","title":"Mise en avant","category":"homegrade-blocks","description":"Bloc pour mettre en avant des informations importantes","supports":{"html":false},"textdomain":"homegrade-blocks__texte-fonctionnel","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"title":{"type":"string","source":"html","selector":"h3"},"iconName":{"type":"string","default":"key"},"hasTitle":{"type":"boolean","default":true}}}');
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/plus-loin","version":"0.1.0","title":"Plus loin","category":"homegrade-blocks","description":"Bloc pour mettre en avant des informations pour aller plus loin","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,39 +7,10 @@
|
|||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.homegrade-blocks-highlight__block-title {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.homegrade-blocks-highlight__titling {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.homegrade-blocks-highlight__titling .icon {
|
||||
background-color: black;
|
||||
border-radius: 50%;
|
||||
aspect-ratio: 1/1;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.homegrade-blocks-highlight__titling .icon img {
|
||||
width: 30px;
|
||||
max-width: 80%;
|
||||
max-height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.homegrade-blocks-highlight__titling h3 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.homegrade-blocks-highlight p + ul {
|
||||
padding-top: 16px;
|
||||
}
|
||||
.homegrade-blocks-highlight ul + p {
|
||||
padding-top: 16px;
|
||||
.wp-block-create-block-multiblocks {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=style-index.css.map*/
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF;AAGC;EACC;EACA;EACA;AADF;AAEE;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAH;AAEG;EACC;EACA;EACA;EACA;AAAJ;AAGE;EACC;AADH;AAWC;EACC;AATF;AAWC;EACC;AATF,C","sources":["webpack://multiblocks/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.homegrade-blocks-highlight {\n\t&__block-title {\n\t\tmargin: 0 !important;\n\t}\n\t&__titling {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tmargin-bottom: 20px;\n\t\t.icon {\n\t\t\tbackground-color: black;\n\t\t\tborder-radius: 50%;\n\t\t\taspect-ratio: 1/1;\n\t\t\twidth: 40px;\n\t\t\theight: 40px;\n\t\t\tpadding: 10px;\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\n\t\t\timg {\n\t\t\t\twidth: 30px;\n\t\t\t\tmax-width: 80%;\n\t\t\t\tmax-height: 100%;\n\t\t\t\theight: auto;\n\t\t\t}\n\t\t}\n\t\th3 {\n\t\t\tpadding-left: 10px;\n\t\t}\n\t}\n\n\t// ul li {\n\t// \tlist-style-type: disc;\n\t// \tlist-style-position: inside;\n\t// \tmargin-left: 1.5em;\n\t// }\n\n\tp + ul {\n\t\tpadding-top: 16px;\n\t}\n\tul + p {\n\t\tpadding-top: 16px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://multiblocks/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-create-block-multiblocks {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
BIN
blocks/plus-loin/src/.DS_Store
vendored
BIN
blocks/plus-loin/src/.DS_Store
vendored
Binary file not shown.
|
|
@ -5,27 +5,13 @@
|
|||
"version": "0.1.0",
|
||||
"title": "Plus loin",
|
||||
"category": "homegrade-blocks",
|
||||
"description": "Bloc pour de liens pour aller plus loin",
|
||||
"description": "Bloc pour mettre en avant des informations pour aller plus loin",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "homegrade-blocks__texte-fonctionnel",
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "h3"
|
||||
},
|
||||
"iconName": {
|
||||
"type": "string",
|
||||
"default": "key"
|
||||
},
|
||||
"hasTitle": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
"attributes": {}
|
||||
}
|
||||
|
|
@ -15,117 +15,17 @@ import {
|
|||
import { ToolbarButton, ToggleControl, PanelBody } from "@wordpress/components";
|
||||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const { title, iconName, hasTitle } = attributes;
|
||||
const handleIconChange = (newIconName) => {
|
||||
setAttributes({ iconName: newIconName });
|
||||
};
|
||||
function getIconPicture() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
return keyIcon;
|
||||
|
||||
case "chain":
|
||||
return chainIcon;
|
||||
|
||||
case "house":
|
||||
return houseIcon;
|
||||
|
||||
case "bulb":
|
||||
return bulbIcon;
|
||||
}
|
||||
}
|
||||
function getDashiconSymbol() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
return "admin-network";
|
||||
|
||||
case "chain":
|
||||
return "admin-links";
|
||||
|
||||
case "house":
|
||||
return "admin-home";
|
||||
|
||||
case "bulb":
|
||||
return "lightbulb";
|
||||
}
|
||||
}
|
||||
function onHasTitleChange() {
|
||||
setAttributes({
|
||||
hasTitle: !hasTitle,
|
||||
title: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
let iconPicture = getIconPicture();
|
||||
let iconDashiconSymbol = getDashiconSymbol();
|
||||
|
||||
return (
|
||||
<>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={__("Titre", "homegrade-blocks__texte-fonctionnel")}
|
||||
initialOpen={true}
|
||||
>
|
||||
<ToggleControl
|
||||
label="Afficher le titre"
|
||||
checked={hasTitle}
|
||||
onChange={onHasTitleChange}
|
||||
/>
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
<BlockControls>
|
||||
<ToolbarButton
|
||||
title={"Clé"}
|
||||
icon={"admin-network"}
|
||||
isActive={iconName === "key"}
|
||||
onClick={() => handleIconChange("key")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Lien"}
|
||||
icon={"admin-links"}
|
||||
isActive={iconName === "chain"}
|
||||
onClick={() => handleIconChange("chain")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Homegrade"}
|
||||
icon={"admin-home"}
|
||||
isActive={iconName === "house"}
|
||||
onClick={() => handleIconChange("house")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Inspiration"}
|
||||
icon={"lightbulb"}
|
||||
isActive={iconName === "bulb"}
|
||||
onClick={() => handleIconChange("bulb")}
|
||||
/>
|
||||
</BlockControls>
|
||||
<section
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-highlight`,
|
||||
})}
|
||||
>
|
||||
{hasTitle && (
|
||||
<div className="homegrade-blocks-highlight__titling">
|
||||
<div className="icon">
|
||||
<img src={iconPicture} alt="" />
|
||||
</div>
|
||||
<RichText
|
||||
className="homegrade-blocks-highlight__block-title"
|
||||
onChange={(value) => setAttributes({ title: value })}
|
||||
value={title}
|
||||
placeholder={__(
|
||||
"Insérez un titre",
|
||||
"homegrade-blocks__texte-fonctionnel"
|
||||
)}
|
||||
tagName="h3"
|
||||
allowedFormats={[]}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<section {...useBlockProps({ className: `homegrade-blocks-plus-loin` })}>
|
||||
<h2 className="homegrade-blocks-plus-loin__block-title">
|
||||
{__("Pour aller plus loin", "homegrade-blocks__texte-fonctionnel")}
|
||||
</h2>
|
||||
|
||||
<InnerBlocks
|
||||
allowedBlocks={[
|
||||
"core/paragraph",
|
||||
"homegrade-blocks/content-heading",
|
||||
"core/list",
|
||||
"core/buttons",
|
||||
"core/button",
|
||||
|
|
|
|||
|
|
@ -4,22 +4,6 @@
|
|||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.homegrade-blocks-highlight {
|
||||
ul {
|
||||
li {
|
||||
// list-style: none !important;
|
||||
display: flex;
|
||||
padding: 10px 0;
|
||||
}
|
||||
li:before {
|
||||
transform: translateY(6px);
|
||||
flex-shrink: 0;
|
||||
border-radius: 50%;
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.wp-block-create-block-multiblocks {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import { __ } from "@wordpress/i18n";
|
||||
import "./style.scss";
|
||||
|
||||
import Edit from "./edit";
|
||||
|
|
@ -7,11 +6,10 @@ import save from "./save";
|
|||
import metadata from "./block.json";
|
||||
|
||||
registerBlockType(metadata.name, {
|
||||
|
||||
icon: {
|
||||
src: (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z" />
|
||||
<path d="M12,22A17.5,17.5,0,0,0,21,6.7V6L12,2,3,6v.7A17.5,17.5,0,0,0,12,22ZM11,6h2V8H11Zm0,4h2v8H11Z" />
|
||||
</svg>
|
||||
),
|
||||
foreground: "#DF1E1E",
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
// $attributes = get_block_attributes();
|
||||
// echo '<pre>';
|
||||
// print_r($block);
|
||||
// echo '</pre>';
|
||||
|
||||
$inner_blocks_html = '';
|
||||
foreach ($block->inner_blocks as $inner_block) {
|
||||
$inner_blocks_html .= $inner_block->render();
|
||||
}
|
||||
?>
|
||||
<section class="homegrade-blocks-highlight">
|
||||
<div class="homegrade-blocks-highlight__titling">
|
||||
<div class="icon">
|
||||
<img src="<?php echo plugin_dir_url(dirname(__DIR__)) ?>src/points-cles/img/icon_feather_key.png" alt="" />
|
||||
</div>
|
||||
<h3 class=""><?php echo __("Les points clés", "homegrade-theme__blocks-texte-fonctionnel") ?></h3>
|
||||
</div>
|
||||
<?php echo $inner_blocks_html ?>
|
||||
|
||||
|
||||
</section>
|
||||
|
|
@ -1,49 +1,16 @@
|
|||
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
|
||||
import { __ } from "@wordpress/i18n";
|
||||
import { useSelect, useDispatch } from "@wordpress/data"; // pour les querry
|
||||
import keyIcon from "./img/icon_feather_key.svg";
|
||||
import chainIcon from "./img/icon_block_chain.svg";
|
||||
import houseIcon from "./img/icon_house.svg";
|
||||
import bulbIcon from "./img/icon_bulb.svg";
|
||||
|
||||
export default function save({ attributes, setAttributes }) {
|
||||
const { title, iconName, hasTitle } = attributes;
|
||||
function getIconPicture() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
return keyIcon;
|
||||
|
||||
case "chain":
|
||||
return chainIcon;
|
||||
|
||||
case "house":
|
||||
return houseIcon;
|
||||
|
||||
case "bulb":
|
||||
return bulbIcon;
|
||||
}
|
||||
}
|
||||
let iconPicture = getIconPicture();
|
||||
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps.save({
|
||||
className: `homegrade-blocks-highlight`,
|
||||
className: `homegrade-blocks-plus-loin`,
|
||||
})}
|
||||
>
|
||||
{hasTitle && (
|
||||
<div className="homegrade-blocks-highlight__titling">
|
||||
<div className="icon">
|
||||
<img clas src={iconPicture} alt="" />
|
||||
</div>
|
||||
|
||||
<RichText.Content
|
||||
tagName="h3"
|
||||
value={title}
|
||||
className="homegrade-blocks-highlight__block-title"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<h2 className="homegrade-blocks-plus-loin__block-title">
|
||||
{__("Pour aller plus loin", "homegrade-blocks__texte-fonctionnel")}
|
||||
</h2>
|
||||
|
||||
<InnerBlocks.Content />
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -5,47 +5,8 @@
|
|||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.homegrade-blocks-highlight {
|
||||
&__block-title {
|
||||
margin: 0 !important;
|
||||
}
|
||||
&__titling {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
.icon {
|
||||
background-color: black;
|
||||
border-radius: 50%;
|
||||
aspect-ratio: 1/1;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
width: 30px;
|
||||
max-width: 80%;
|
||||
max-height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
h3 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
// ul li {
|
||||
// list-style-type: disc;
|
||||
// list-style-position: inside;
|
||||
// margin-left: 1.5em;
|
||||
// }
|
||||
|
||||
p + ul {
|
||||
padding-top: 16px;
|
||||
}
|
||||
ul + p {
|
||||
padding-top: 16px;
|
||||
}
|
||||
.wp-block-create-block-multiblocks {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -45,7 +45,6 @@ function create_block_multiblocks_block_init()
|
|||
register_block_type(__DIR__ . '/blocks/vocabulaire-summary/build');
|
||||
register_block_type(__DIR__ . '/blocks/focused-schema/build');
|
||||
register_block_type(__DIR__ . '/blocks/focused-thematique/build');
|
||||
register_block_type(__DIR__ . '/blocks/table/build');
|
||||
// register_block_type(__DIR__ . '/blocks/chapitrage-thematique/build');
|
||||
// register_block_type(__DIR__ . '/blocks/illustration-thematique/build');
|
||||
|
||||
|
|
@ -55,6 +54,8 @@ function create_block_multiblocks_block_init()
|
|||
register_block_type(__DIR__ . '/blocks/picture-banner/build');
|
||||
register_block_type(__DIR__ . '/blocks/highlight/build');
|
||||
register_block_type(__DIR__ . '/blocks/aside/build');
|
||||
register_block_type(__DIR__ . '/blocks/table/build');
|
||||
register_block_type(__DIR__ . '/blocks/plus-loin/build');
|
||||
}
|
||||
add_action('init', 'create_block_multiblocks_block_init');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user