handling step-icon
This commit is contained in:
parent
257bb82e35
commit
8806e80888
|
|
@ -1 +1 @@
|
||||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '7e14e234e0e8cc630996');
|
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '64c2804f5325424c877c');
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,13 @@ function Edit({
|
||||||
relatedPostId
|
relatedPostId
|
||||||
} = attributes;
|
} = attributes;
|
||||||
const post = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core").getEntityRecord("postType", "parcours", relatedPostId));
|
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"], {
|
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,
|
relatedPostId: relatedPostId,
|
||||||
setAttributes: setAttributes
|
setAttributes: setAttributes
|
||||||
|
|
@ -140,7 +147,13 @@ function Edit({
|
||||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({
|
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({
|
||||||
className: `homegrade-blocks-parcours-step parcours-step parcours-step-card`
|
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":
|
case "urbanisme":
|
||||||
return "energies-urbanisme";
|
return "energies-urbanisme";
|
||||||
case "acoustique":
|
case "acoustique":
|
||||||
case "petites-coproprietes":
|
case "coproprietes":
|
||||||
return "acoustique-coproprietes";
|
return "acoustique-coproprietes";
|
||||||
case "isolation":
|
case "isolation":
|
||||||
case "au-quotidien":
|
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) =>
|
const post = useSelect((select) =>
|
||||||
select("core").getEntityRecord("postType", "parcours", relatedPostId)
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<OptionsSelectControl
|
<OptionsSelectControl
|
||||||
relatedPostId={relatedPostId}
|
relatedPostId={relatedPostId}
|
||||||
setAttributes={setAttributes}
|
setAttributes={setAttributes}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
{...useBlockProps({
|
{...useBlockProps({
|
||||||
className: `homegrade-blocks-parcours-step parcours-step parcours-step-card`,
|
className: `homegrade-blocks-parcours-step parcours-step parcours-step-card`,
|
||||||
|
|
@ -23,7 +33,8 @@ export default function Edit({ attributes, setAttributes }) {
|
||||||
>
|
>
|
||||||
{post && (
|
{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>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user