Compare commits
10 Commits
2f415f4fa4
...
8806e80888
| Author | SHA1 | Date | |
|---|---|---|---|
| 8806e80888 | |||
| 257bb82e35 | |||
| 4e52c87fd1 | |||
| fd9a7ee1c2 | |||
| 4b37855deb | |||
| 14a62b8764 | |||
| 508b718876 | |||
| bbc5d883e3 | |||
| 7b57772c92 | |||
| 37de8bc461 |
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'bd0654b3242e44a3b8d4');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e5ce9758e2e101ceee61');
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ function Edit({
|
|||
})
|
||||
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InnerBlocks, {
|
||||
template: TEMPLATE,
|
||||
allowedBlocks: ["core/paragraph", "homegrade-content-blocks/post-card",
|
||||
allowedBlocks: ["core/paragraph", "homegrade-content-blocks/post-card", "homegrade-content-blocks/page-card",
|
||||
// "homegrade-content-blocks/column-card",
|
||||
"homegrade-content-blocks/card-free"]
|
||||
})));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -73,6 +73,7 @@ export default function Edit({ attributes, setAttributes, clientId }) {
|
|||
allowedBlocks={[
|
||||
"core/paragraph",
|
||||
"homegrade-content-blocks/post-card",
|
||||
"homegrade-content-blocks/page-card",
|
||||
// "homegrade-content-blocks/column-card",
|
||||
"homegrade-content-blocks/card-free",
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@
|
|||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php",
|
||||
"attributes": {
|
||||
"hasCustomTitle": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"pageHeaderTitle": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '33d8b36cf2904cb62a91');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'de0da04da745c8c7f08b');
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ function Edit({
|
|||
setAttributes
|
||||
}) {
|
||||
const {
|
||||
hasCustomTitle,
|
||||
hasCta,
|
||||
cta,
|
||||
hasCustomImage,
|
||||
|
|
@ -158,16 +157,6 @@ function Edit({
|
|||
return Image;
|
||||
}
|
||||
});
|
||||
function onChangeHasCustomTitle(newHasAutoTitle) {
|
||||
setAttributes({
|
||||
hasCustomTitle: !hasCustomTitle
|
||||
});
|
||||
if (newHasAutoTitle) {
|
||||
setAttributes({
|
||||
blockCustomTitle: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
function onChangeHasCustomImage(newHasAutoImage) {
|
||||
setAttributes({
|
||||
hasCustomImage: !hasCustomImage
|
||||
|
|
@ -225,13 +214,6 @@ function Edit({
|
|||
});
|
||||
}
|
||||
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.PanelBody, {
|
||||
className: "homegrade-blocks-content-page-header__panel-cta",
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du bloc", "homegrade-blocks")
|
||||
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToggleControl, {
|
||||
label: "Titre automatique",
|
||||
checked: !hasCustomTitle,
|
||||
onChange: onChangeHasCustomTitle
|
||||
}), !hasCustomTitle && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.Tip, null, "Le titre est automatiquement g\xE9n\xE9r\xE9 \xE0 partir du titre de la page")), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.PanelBody, {
|
||||
className: "homegrade-blocks-components-image__panel-body",
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Image d'accompagnement", "homegrade-blocks")
|
||||
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToggleControl, {
|
||||
|
|
@ -346,10 +328,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_5__.name, {
|
||||
icon: {
|
||||
foreground: "#f03",
|
||||
foreground: "#DF1E1E",
|
||||
src: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", {
|
||||
id: "Calque_2",
|
||||
"data-name": "Calque 2",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 401.94 401.92"
|
||||
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("defs", null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", {
|
||||
|
|
@ -536,7 +516,7 @@ module.exports = window["wp"]["primitives"];
|
|||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/content-page-header","version":"0.1.0","title":"Content page header","category":"homegrade-blocks","icon":"smiley","description":"Bloc bannière/header de contenu de premier niveau pour les pages de contenu","supports":{"html":false,"anchor":true},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"hasCustomTitle":{"type":"boolean","default":false},"pageHeaderTitle":{"type":"string"},"hasCta":{"type":"boolean","default":false},"cta":{"type":"object"},"hasCustomImage":{"type":"boolean","default":false},"imageUrl":{"type":"string"},"imageAlt":{"type":"string"},"imageId":{"type":"number"},"imageProportion":{"type":"string","default":"original"},"anchor":{"type":"string"},"coverSize":{"type":"string","default":"medium"}}}');
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/content-page-header","version":"0.1.0","title":"Content page header","category":"homegrade-blocks","icon":"smiley","description":"Bloc bannière/header de contenu de premier niveau pour les pages de contenu","supports":{"html":false,"anchor":true},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"pageHeaderTitle":{"type":"string"},"hasCta":{"type":"boolean","default":false},"cta":{"type":"object"},"hasCustomImage":{"type":"boolean","default":false},"imageUrl":{"type":"string"},"imageAlt":{"type":"string"},"imageId":{"type":"number"},"imageProportion":{"type":"string","default":"original"},"anchor":{"type":"string"},"coverSize":{"type":"string","default":"medium"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,10 +17,6 @@
|
|||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php",
|
||||
"attributes": {
|
||||
"hasCustomTitle": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"pageHeaderTitle": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import { lock, trash } from "@wordpress/icons";
|
|||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const {
|
||||
hasCustomTitle,
|
||||
hasCta,
|
||||
cta,
|
||||
hasCustomImage,
|
||||
|
|
@ -43,12 +42,6 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
}
|
||||
});
|
||||
|
||||
function onChangeHasCustomTitle(newHasAutoTitle) {
|
||||
setAttributes({ hasCustomTitle: !hasCustomTitle });
|
||||
if (newHasAutoTitle) {
|
||||
setAttributes({ blockCustomTitle: undefined });
|
||||
}
|
||||
}
|
||||
function onChangeHasCustomImage(newHasAutoImage) {
|
||||
setAttributes({ hasCustomImage: !hasCustomImage });
|
||||
if (!newHasAutoImage) {
|
||||
|
|
@ -100,21 +93,6 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
return (
|
||||
<>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
className="homegrade-blocks-content-page-header__panel-cta"
|
||||
title={__("Titre du bloc", "homegrade-blocks")}
|
||||
>
|
||||
<ToggleControl
|
||||
label="Titre automatique"
|
||||
checked={!hasCustomTitle}
|
||||
onChange={onChangeHasCustomTitle}
|
||||
/>
|
||||
{!hasCustomTitle && (
|
||||
<Tip>
|
||||
Le titre est automatiquement généré à partir du titre de la page
|
||||
</Tip>
|
||||
)}
|
||||
</PanelBody>
|
||||
<PanelBody
|
||||
className="homegrade-blocks-components-image__panel-body"
|
||||
title={__("Image d'accompagnement", "homegrade-blocks")}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'b2497f3adddcc923a91c');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '741e30b111a2465ca4f5');
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/*!****************************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!../../node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***!
|
||||
\****************************************************************************************************************************************************************************************************************************************************/
|
||||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.wp-block-create-block-test {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=index.css.map*/
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://test/./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-test {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -2,6 +2,60 @@
|
|||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./src/img/arrow-right-circle.svg":
|
||||
/*!****************************************!*\
|
||||
!*** ./src/img/arrow-right-circle.svg ***!
|
||||
\****************************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ ReactComponent: () => (/* binding */ SvgArrowRightCircle),
|
||||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||
var _g;
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
var SvgArrowRightCircle = function SvgArrowRightCircle(props) {
|
||||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
width: 47,
|
||||
height: 47
|
||||
}, props), _g || (_g = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", {
|
||||
"data-name": "Groupe 3134",
|
||||
fill: "none",
|
||||
stroke: "#000",
|
||||
strokeWidth: 2
|
||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", {
|
||||
"data-name": "Groupe 1270",
|
||||
strokeLinecap: "round",
|
||||
strokeLinejoin: "round"
|
||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
|
||||
"data-name": "Ligne 6",
|
||||
d: "M13.929 23.15H33.75"
|
||||
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
|
||||
"data-name": "Trac\\xE9 162",
|
||||
d: "m27.419 29.478 6.33-6.33-6.33-6.33"
|
||||
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", {
|
||||
"data-name": "Ellipse 202"
|
||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("circle", {
|
||||
cx: 23.5,
|
||||
cy: 23.5,
|
||||
r: 23.5,
|
||||
stroke: "none"
|
||||
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("circle", {
|
||||
cx: 23.5,
|
||||
cy: 23.5,
|
||||
r: 22.5
|
||||
})))));
|
||||
};
|
||||
|
||||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0NyIgaGVpZ2h0PSI0NyIgdmlld0JveD0iMCAwIDQ3IDQ3Ij4KICA8ZyBpZD0iR3JvdXBlXzMxMzQiIGRhdGEtbmFtZT0iR3JvdXBlIDMxMzQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNjAuODQyIC00NTkpIj4KICAgIDxnIGlkPSJHcm91cGVfMTI3MCIgZGF0YS1uYW1lPSJHcm91cGUgMTI3MCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjc0Ljc3MSA0NzUuODIpIj4KICAgICAgPGxpbmUgaWQ9IkxpZ25lXzYiIGRhdGEtbmFtZT0iTGlnbmUgNiIgeDI9IjE5LjgyMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA2LjMzKSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMiIvPgogICAgICA8cGF0aCBpZD0iVHJhY8OpXzE2MiIgZGF0YS1uYW1lPSJUcmFjw6kgMTYyIiBkPSJNMTA0LjgxOCw4Mi44bDYuMzMtNi4zMy02LjMzLTYuMzMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC05MS4zMjggLTcwLjE0MikiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjIiLz4KICAgIDwvZz4KICAgIDxnIGlkPSJFbGxpcHNlXzIwMiIgZGF0YS1uYW1lPSJFbGxpcHNlIDIwMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjYwLjg0MiA0NTkpIiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiI+CiAgICAgIDxjaXJjbGUgY3g9IjIzLjUiIGN5PSIyMy41IiByPSIyMy41IiBzdHJva2U9Im5vbmUiLz4KICAgICAgPGNpcmNsZSBjeD0iMjMuNSIgY3k9IjIzLjUiIHI9IjIyLjUiIGZpbGw9Im5vbmUiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/OptionsSelectControl.js":
|
||||
/*!*************************************!*\
|
||||
!*** ./src/OptionsSelectControl.js ***!
|
||||
|
|
@ -137,6 +191,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
|
||||
/* harmony import */ var _img_arrow_right_circle_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./img/arrow-right-circle.svg */ "./src/img/arrow-right-circle.svg");
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -152,7 +208,6 @@ function Edit({
|
|||
postType
|
||||
} = attributes;
|
||||
const page = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core").getEntityRecord("postType", postType, relatedPostId));
|
||||
console.log("page", page);
|
||||
const pageIconUrl = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => {
|
||||
if (postType === "page") {
|
||||
if (!page?.acf?.page_icon) return null;
|
||||
|
|
@ -160,7 +215,6 @@ function Edit({
|
|||
}
|
||||
if (postType === "parcours") {
|
||||
if (!page?.acf?.step_icon) return null;
|
||||
console.log(page);
|
||||
return select("core").getMedia(page?.acf?.step_icon)?.source_url;
|
||||
}
|
||||
}, [page]);
|
||||
|
|
@ -173,10 +227,24 @@ function Edit({
|
|||
className: `homegrade-blocks-page-card`
|
||||
})
|
||||
}, page && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
class: "page-card__icon",
|
||||
className: "homegrade-blocks-page-card__icon",
|
||||
src: pageIconUrl,
|
||||
alt: ""
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, page.title.rendered), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, page.excerpt?.raw))));
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", {
|
||||
className: "homegrade-blocks-page-card__title"
|
||||
}, page.title.rendered), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", {
|
||||
className: "homegrade-blocks-page-card__excerpt"
|
||||
}, page.excerpt?.raw), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
class: "homegrade-blocks-page-card__cta",
|
||||
href: "<?php echo $relatedPostUrl ?>",
|
||||
target: "_self",
|
||||
rel: "noopener"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, "En savoir plus"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
class: "cta_arrow_button"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
src: _img_arrow_right_circle_svg__WEBPACK_IMPORTED_MODULE_6__["default"],
|
||||
alt: ""
|
||||
}))))));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -295,6 +363,16 @@ __webpack_require__.r(__webpack_exports__);
|
|||
// extracted by mini-css-extract-plugin
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "react":
|
||||
/*!************************!*\
|
||||
!*** external "React" ***!
|
||||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["React"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/block-editor":
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,7 +7,6 @@ $relatedPostUrl = get_permalink($relatedPostId) ?? null;
|
|||
$postIcon = get_field("step_icon", $relatedPostId) ?? null;
|
||||
$excerpt = get_the_excerpt($relatedPostId) ?? null;
|
||||
|
||||
|
||||
?>
|
||||
<a class="homegrade-blocks-page-card" href="<?php echo $relatedPostUrl ?>" target="<?php echo $target ?>">
|
||||
<img class="homegrade-blocks-page-card__icon" src="<?php echo $postIcon['url'] ?>" alt="">
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
/*!***************************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!../../node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***!
|
||||
\***************************************************************************************************************************************************************************************************************************************************/
|
||||
/**
|
||||
* The following styles get applied both on the front of your site
|
||||
* and in the editor.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.wp-block-create-block-test {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=style-index.css.map*/
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://test/./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-test {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -3,13 +3,13 @@ import { useBlockProps } from "@wordpress/block-editor";
|
|||
import OptionsSelectControl from "./OptionsSelectControl";
|
||||
import { useSelect } from "@wordpress/data";
|
||||
import "./editor.scss";
|
||||
import arrow from "./img/arrow-right-circle.svg";
|
||||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const { relatedPostId, postType } = attributes;
|
||||
const page = useSelect((select) =>
|
||||
select("core").getEntityRecord("postType", postType, relatedPostId)
|
||||
);
|
||||
console.log("page", page);
|
||||
|
||||
const pageIconUrl = useSelect(
|
||||
(select) => {
|
||||
|
|
@ -19,7 +19,6 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
}
|
||||
if (postType === "parcours") {
|
||||
if (!page?.acf?.step_icon) return null;
|
||||
console.log(page);
|
||||
return select("core").getMedia(page?.acf?.step_icon)?.source_url;
|
||||
}
|
||||
},
|
||||
|
|
@ -33,6 +32,7 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
setAttributes={setAttributes}
|
||||
postType={postType}
|
||||
/>
|
||||
|
||||
<div
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-page-card`,
|
||||
|
|
@ -40,10 +40,29 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
>
|
||||
{page && (
|
||||
<>
|
||||
<img class="page-card__icon" src={pageIconUrl} alt="" />
|
||||
<img
|
||||
className="homegrade-blocks-page-card__icon"
|
||||
src={pageIconUrl}
|
||||
alt=""
|
||||
/>
|
||||
|
||||
<h3>{page.title.rendered}</h3>
|
||||
<p>{page.excerpt?.raw}</p>
|
||||
<h3 className="homegrade-blocks-page-card__title">
|
||||
{page.title.rendered}
|
||||
</h3>
|
||||
<p className="homegrade-blocks-page-card__excerpt">
|
||||
{page.excerpt?.raw}
|
||||
</p>
|
||||
<div
|
||||
class="homegrade-blocks-page-card__cta"
|
||||
href="<?php echo $relatedPostUrl ?>"
|
||||
target="_self"
|
||||
rel="noopener"
|
||||
>
|
||||
<p>En savoir plus</p>
|
||||
<div class="cta_arrow_button">
|
||||
<img src={arrow} alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
12
blocks/page-card/src/img/arrow-right-circle.svg
Normal file
12
blocks/page-card/src/img/arrow-right-circle.svg
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="47" height="47" viewBox="0 0 47 47">
|
||||
<g id="Groupe_3134" data-name="Groupe 3134" transform="translate(-260.842 -459)">
|
||||
<g id="Groupe_1270" data-name="Groupe 1270" transform="translate(274.771 475.82)">
|
||||
<line id="Ligne_6" data-name="Ligne 6" x2="19.821" transform="translate(0 6.33)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
|
||||
<path id="Tracé_162" data-name="Tracé 162" d="M104.818,82.8l6.33-6.33-6.33-6.33" transform="translate(-91.328 -70.142)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
|
||||
</g>
|
||||
<g id="Ellipse_202" data-name="Ellipse 202" transform="translate(260.842 459)" fill="none" stroke="#000" stroke-width="2">
|
||||
<circle cx="23.5" cy="23.5" r="23.5" stroke="none"/>
|
||||
<circle cx="23.5" cy="23.5" r="22.5" fill="none"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 929 B |
|
|
@ -7,7 +7,6 @@ $relatedPostUrl = get_permalink($relatedPostId) ?? null;
|
|||
$postIcon = get_field("step_icon", $relatedPostId) ?? null;
|
||||
$excerpt = get_the_excerpt($relatedPostId) ?? null;
|
||||
|
||||
|
||||
?>
|
||||
<a class="homegrade-blocks-page-card" href="<?php echo $relatedPostUrl ?>" target="<?php echo $target ?>">
|
||||
<img class="homegrade-blocks-page-card__icon" src="<?php echo $postIcon['url'] ?>" alt="">
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'c669f5220322c1cd6a7c');
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '64c2804f5325424c877c');
|
||||
|
|
|
|||
|
|
@ -133,14 +133,27 @@ function Edit({
|
|||
relatedPostId
|
||||
} = attributes;
|
||||
const post = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core").getEntityRecord("postType", "parcours", relatedPostId));
|
||||
const stepIconUrl = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => {
|
||||
var _media$source_url;
|
||||
let setpIconID = post?.acf?.step_icon;
|
||||
const media = select("core").getMedia(setpIconID);
|
||||
return (_media$source_url = media?.source_url) !== null && _media$source_url !== void 0 ? _media$source_url : null;
|
||||
}, [post]);
|
||||
console.log(post);
|
||||
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)(_OptionsSelectControl__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
||||
relatedPostId: relatedPostId,
|
||||
setAttributes: setAttributes
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({
|
||||
className: `homegrade-blocks-parcours-step`
|
||||
className: `homegrade-blocks-parcours-step parcours-step parcours-step-card`
|
||||
})
|
||||
}, post && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, post.title.rendered))));
|
||||
}, post && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
class: "parcours-step-card__icon",
|
||||
src: stepIconUrl,
|
||||
alt: ""
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", {
|
||||
className: "parcours-step-card__title"
|
||||
}, post.title.rendered))));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -203,7 +216,7 @@ function getThematiqueFamilySlug(thematique_slug) {
|
|||
case "urbanisme":
|
||||
return "energies-urbanisme";
|
||||
case "acoustique":
|
||||
case "petites-coproprietes":
|
||||
case "coproprietes":
|
||||
return "acoustique-coproprietes";
|
||||
case "isolation":
|
||||
case "au-quotidien":
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,13 +9,23 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
const post = useSelect((select) =>
|
||||
select("core").getEntityRecord("postType", "parcours", relatedPostId)
|
||||
);
|
||||
const stepIconUrl = useSelect(
|
||||
(select) => {
|
||||
let setpIconID = post?.acf?.step_icon;
|
||||
const media = select("core").getMedia(setpIconID);
|
||||
return media?.source_url ?? null;
|
||||
},
|
||||
[post]
|
||||
);
|
||||
|
||||
console.log(post);
|
||||
return (
|
||||
<>
|
||||
<OptionsSelectControl
|
||||
relatedPostId={relatedPostId}
|
||||
setAttributes={setAttributes}
|
||||
/>
|
||||
|
||||
<div
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-parcours-step parcours-step parcours-step-card`,
|
||||
|
|
@ -23,7 +33,8 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
>
|
||||
{post && (
|
||||
<>
|
||||
<h3>{post.title.rendered}</h3>
|
||||
<img class="parcours-step-card__icon" src={stepIconUrl} alt="" />
|
||||
<h3 className="parcours-step-card__title">{post.title.rendered}</h3>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ if ($relatedPost) {
|
|||
?>
|
||||
|
||||
|
||||
<section id="<?php echo $anchor ?>" class="post-content-container <?php echo $anchor ? "has-custom-anchor" : "" ?>">
|
||||
<section id="<?php echo $anchor ?>" class="post-content-container <?php echo $anchor ? "has-custom-anchor" : "" ?>" data-related-id="<?php echo $relatedPostId ?>">
|
||||
<h2 class="post-content-container__title"><?php echo $relatedPost->post_title ?></h2>
|
||||
<?php echo $content; ?>
|
||||
</section>
|
||||
|
|
@ -23,7 +23,7 @@ if ($relatedPost) {
|
|||
?>
|
||||
|
||||
|
||||
<section id="<?php echo $anchor ?>" class="post-content-container <?php echo $anchor ? "has-custom-anchor" : "" ?>">
|
||||
<section id="<?php echo $anchor ?>" class="post-content-container <?php echo $anchor ? "has-custom-anchor" : "" ?>" data-related-id="<?php echo $relatedPostId ?>">
|
||||
<h2 class="post-content-container__title"><?php echo $relatedPost->post_title ?></h2>
|
||||
<?php echo $content; ?>
|
||||
</section>
|
||||
|
|
@ -5,7 +5,7 @@ export function getThematiqueFamilySlug(thematique_slug) {
|
|||
return "energies-urbanisme";
|
||||
|
||||
case "acoustique":
|
||||
case "petites-coproprietes":
|
||||
case "coproprietes":
|
||||
return "acoustique-coproprietes";
|
||||
|
||||
case "isolation":
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '0adf7d4b366ba2123cb1');
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '10f43e16ebf389dccac0');
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ const trash = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(
|
|||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ cleanString: () => (/* binding */ cleanString),
|
||||
/* harmony export */ getAdminLanguageFromCookie: () => (/* binding */ getAdminLanguageFromCookie),
|
||||
/* harmony export */ getThematiqueFamilySlug: () => (/* binding */ getThematiqueFamilySlug)
|
||||
/* harmony export */ });
|
||||
function getThematiqueFamilySlug(thematique_slug) {
|
||||
|
|
@ -64,6 +66,25 @@ function getThematiqueFamilySlug(thematique_slug) {
|
|||
return "location";
|
||||
}
|
||||
}
|
||||
function cleanString(string) {
|
||||
return string.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().split(" ").join("-");
|
||||
}
|
||||
function getAdminLanguageFromCookie(c_name) {
|
||||
var c_value = document.cookie,
|
||||
c_start = c_value.indexOf(" " + c_name + "=");
|
||||
if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
|
||||
if (c_start == -1) {
|
||||
c_value = null;
|
||||
} else {
|
||||
c_start = c_value.indexOf("=", c_start) + 1;
|
||||
var c_end = c_value.indexOf(";", c_start);
|
||||
if (c_end == -1) {
|
||||
c_end = c_value.length;
|
||||
}
|
||||
c_value = unescape(c_value.substring(c_start, c_end));
|
||||
}
|
||||
return c_value;
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
|
@ -119,7 +140,6 @@ const BrochureLinkFormatButton = props => {
|
|||
}
|
||||
});
|
||||
function setFormat(postDatas) {
|
||||
console.log("postdata", postDatas);
|
||||
setIsPopoverOpen(!isPopoverOpen);
|
||||
setPendingBrochure(true);
|
||||
onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.applyFormat)(value, {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -62,6 +62,7 @@ function create_block_multiblocks_block_init()
|
|||
register_block_type(__DIR__ . '/blocks/offres-emplois/build');
|
||||
register_block_type(__DIR__ . '/blocks/client-statisfaction/build');
|
||||
register_block_type(__DIR__ . '/blocks/post-card/build');
|
||||
register_block_type(__DIR__ . '/blocks/page-card/build');
|
||||
// register_block_type(__DIR__ . '/blocks/internationnalisation/build');
|
||||
|
||||
// Statics
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user