Compare commits

...

8 Commits

Author SHA1 Message Date
Antoine M
90a7a16dfb FEATURE introducing new variation
All checks were successful
continuous-integration/drone/push Build is passing
2026-03-20 17:11:42 +01:00
Antoine M
ccc2d0008f REFACTOR Moving component from dynamiques-blocks to carhop-blocks 2026-03-20 17:11:26 +01:00
Antoine M
56db874fc3 REFACTOR Moving component from dynamiques-blocks to carhop-blocks 2026-03-20 17:11:12 +01:00
Antoine M
67ccfdee1f FEATURE introducing the tab and tab-group component 2026-03-20 17:10:34 +01:00
Antoine M
b387694f07 REBUILD 2026-03-20 17:10:04 +01:00
Antoine M
d93845c777 REFACTOR Moving component from dynamiques-blocks to carhop-blocks 2026-03-20 17:09:49 +01:00
Antoine M
5ccff70aff FEATURE Handling open in new tab 2026-03-20 17:09:20 +01:00
Antoine M
a62f00f31e FEATURE Introducing the component 2026-03-20 17:08:48 +01:00
95 changed files with 3291 additions and 153 deletions

View File

@ -524,6 +524,84 @@ return array(
)
)
),
'document-card' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
'name' => 'carhop-blocks/document-card',
'version' => '0.1.0',
'title' => 'Document Card',
'category' => 'carhop-blocks',
'icon' => 'smiley',
'description' => 'Document Card pour la mise en forme supérieure d\'éléments de contenu',
'example' => array(
),
'supports' => array(
'html' => false,
'color' => array(
'text' => true,
'background' => false,
'link' => false
)
),
'textdomain' => 'document-card',
'editorScript' => 'file:./index.js',
'editorStyle' => 'file:./index.css',
'style' => 'file:./style-index.css',
'viewScript' => 'file:./view.js',
'attributes' => array(
'isInitilized' => array(
'type' => 'boolean',
'default' => false
),
'documentType' => array(
'type' => 'string',
'default' => 'document',
'enum' => array(
'internal',
'external'
)
),
'documentFileSize' => array(
'type' => 'number',
'default' => 0
),
'documentUrl' => array(
'type' => 'string',
'default' => ''
),
'documentId' => array(
'type' => 'number',
'default' => 0
),
'UserhasValidatedExternalUrl' => array(
'type' => 'boolean',
'default' => false
)
)
),
'explore-tags' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
'name' => 'carhop-blocks/explore-tags',
'version' => '0.1.0',
'title' => 'Explore Tags',
'category' => 'carhop-blocks',
'icon' => 'smiley',
'description' => 'Example block scaffolded with Create Block tool.',
'example' => array(
),
'supports' => array(
'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'
),
'featured-news' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
@ -1050,6 +1128,65 @@ return array(
)
)
),
'tab' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
'name' => 'carhop-blocks/tab',
'version' => '0.1.0',
'title' => 'Tab',
'category' => 'carhop-blocks',
'icon' => 'smiley',
'description' => 'Tab pour la mise en forme supérieure d\'éléments de contenu',
'example' => array(
),
'supports' => array(
'html' => false,
'color' => array(
'text' => true,
'background' => false,
'link' => false
)
),
'textdomain' => 'tab',
'editorScript' => 'file:./index.js',
'editorStyle' => 'file:./index.css',
'style' => 'file:./style-index.css',
'viewScript' => 'file:./view.js',
'attributes' => array(
'title' => array(
'type' => 'string',
'default' => ''
)
)
),
'tab-group' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
'name' => 'carhop-blocks/tab-group',
'version' => '0.1.0',
'title' => 'Tab Group',
'category' => 'carhop-blocks',
'icon' => 'smiley',
'description' => 'Tab Group pour la mise en forme supérieure d\'éléments de contenu',
'example' => array(
),
'supports' => array(
'html' => false,
'color' => array(
'text' => true,
'background' => false,
'link' => false
)
),
'textdomain' => 'tab-group',
'editorScript' => 'file:./index.js',
'editorStyle' => 'file:./index.css',
'style' => 'file:./style-index.css',
'viewScript' => 'file:./view.js',
'render' => 'file:./render.php'
),
'decouvrez-prochainement' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n'), 'version' => 'f5906ee56e4f48b43c73');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n'), 'version' => '9210a38eaa347a81247e');

View File

@ -172,6 +172,9 @@ function Edit({
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, {
value: "backgrounded",
label: "Fond color\xE9"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, {
value: "framed-backgrounded",
label: "Cadre + fond color\xE9"
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, {
label: "Largeur du bloc",
@ -192,7 +195,7 @@ function Edit({
value: "full",
label: "Pleine largeur"
})]
}), blockVariant === "backgrounded" && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Card, {
}), blockVariant === "backgrounded" || blockVariant === "framed-backgrounded" && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Card, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CardHeader, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h1", {
children: "Couleur de fond"
@ -206,7 +209,7 @@ function Edit({
})
})
})]
}), blockVariant === "backgrounded" && postType !== "articles" && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Card, {
}), (blockVariant === "backgrounded" || blockVariant === "framed-backgrounded") && postType !== "articles" && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Card, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CardHeader, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h1", {
children: "Couleur du texte "
@ -226,7 +229,7 @@ function Edit({
${blockWidth === "contained" ? "aligncontained" : blockWidth === "wide" ? "alignwide" : "alignfull"}`,
style: {
"--content-box-text-color": textColor !== null && textColor !== void 0 ? textColor : "inherit",
"--content-box-background-color": blockVariant === "backgrounded" ? backgroundColor : "transparent"
"--content-box-background-color": blockVariant === "backgrounded" || blockVariant === "framed-backgrounded" ? backgroundColor : "transparent"
}
}),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
@ -235,7 +238,7 @@ function Edit({
template: [["core/paragraph", {
placeholder: "Ajouter ici le texte"
}]],
allowedBlocks: ["core/heading", "core/paragraph", "core/group", "core/list", "core/button", "core/image", "core/buttons", "core/columns", "core/post-title", "core/embed", "core/quote", "core/pullquote", "core/media-text", "core/table", "carhop-blocks/chapter-section", "carhop-blocks/heading", "carhop-blocks/decorative-shapes", "carhop-blocks/scroll-story-block", "carhop-blocks/cta", "carhop-blocks/cta-group", "carhop-blocks/audio-player", "carhop-blocks/content-box", "carhop-blocks/localisation-map", "carhop-blocks/notice-panel", "carhop-blocks/story-timeline", "carhop-blocks/highlight-timeline", "acf/statistics-datas", "ninja-forms/form", "gravityforms/form", "dynamiques-blocks/sitemap", "mailpoet/subscription-form-block", "shortcode"]
allowedBlocks: ["core/heading", "core/paragraph", "core/group", "core/list", "core/button", "core/image", "core/buttons", "core/columns", "core/file", "core/post-title", "core/embed", "core/quote", "core/pullquote", "core/media-text", "core/table", "carhop-blocks/chapter-section", "carhop-blocks/heading", "carhop-blocks/decorative-shapes", "carhop-blocks/scroll-story-block", "carhop-blocks/cta", "carhop-blocks/cta-group", "carhop-blocks/audio-player", "carhop-blocks/content-box", "carhop-blocks/localisation-map", "carhop-blocks/notice-panel", "carhop-blocks/story-timeline", "carhop-blocks/highlight-timeline", "acf/statistics-datas", "ninja-forms/form", "gravityforms/form", "dynamiques-blocks/sitemap", "mailpoet/subscription-form-block", "shortcode"]
})
})
})]
@ -334,7 +337,7 @@ function save({
${blockWidth === "contained" ? "aligncontained" : blockWidth === "wide" ? "alignwide" : "alignfull"}`,
style: {
"--content-box-text-color": textColor !== null && textColor !== void 0 ? textColor : "inherit",
"--content-box-background-color": blockVariant === "backgrounded" ? backgroundColor : "transparent"
"--content-box-background-color": blockVariant === "backgrounded" || blockVariant === "framed-backgrounded" ? backgroundColor : "transparent"
}
}),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '50500d02111d188b5bf6');
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '1a1c96d4851a5a9d92ea');

View File

@ -46,7 +46,8 @@ function Edit({
setAttributes
}) {
const {
color
color,
link
} = attributes;
const colors = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useSetting)("color.palette.theme");
function handleColorChange(value) {
@ -54,7 +55,6 @@ function Edit({
color: value
});
}
console.log(color);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.BlockControls, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.AlignmentToolbar, {

File diff suppressed because one or more lines are too long

View File

@ -3,9 +3,7 @@ $align = isset($attributes['align']) ? $attributes['align'] : '';
$link = isset($attributes['link']) ? $attributes['link'] : [];
$text = isset($attributes['text']) ? $attributes['text'] : '';
$color = isset($attributes['color']) ? $attributes['color'] : '';
$target = isset($link) && $link['opensInNewTab'] ? '_blank' : '_self';
$styles = [];
if ($color) {
@ -21,6 +19,6 @@ $wrapper_attributes = get_block_wrapper_attributes([
$link_url = isset($link['url']) ? esc_url($link['url']) : '#';
?>
<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?>>
<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?> target="<?php echo $target; ?>">
<?php echo esc_html($text); ?>
</a>

View File

@ -0,0 +1,54 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "carhop-blocks/document-card",
"version": "0.1.0",
"title": "Document Card",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Document Card pour la mise en forme supérieure d'éléments de contenu",
"example": {},
"supports": {
"html": false,
"color": {
"text": true,
"background": false,
"link": false
}
},
"textdomain": "document-card",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"isInitilized": {
"type": "boolean",
"default": false
},
"documentType": {
"type": "string",
"default": "document",
"enum": [
"internal",
"external"
]
},
"documentFileSize": {
"type": "number",
"default": 0
},
"documentUrl": {
"type": "string",
"default": ""
},
"documentId": {
"type": "number",
"default": 0
},
"UserhasValidatedExternalUrl": {
"type": "boolean",
"default": false
}
}
}

View File

@ -0,0 +1,4 @@
/*!***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/document-card/editor.scss ***!
\***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-primitives'), 'version' => '9460e2344c1ecebbf7da');

View File

@ -0,0 +1,4 @@
/*!***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/document-card/editor.scss ***!
\***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/

View File

@ -0,0 +1,681 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/.pnpm/@wordpress+icons@11.2.0_react@18.3.1/node_modules/@wordpress/icons/build-module/library/file.js":
/*!****************************************************************************************************************************!*\
!*** ./node_modules/.pnpm/@wordpress+icons@11.2.0_react@18.3.1/node_modules/@wordpress/icons/build-module/library/file.js ***!
\****************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ file_default)
/* harmony export */ });
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
// packages/icons/src/library/file.tsx
var file_default = /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(
_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.Path,
{
fillRule: "evenodd",
clipRule: "evenodd",
d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
}
) });
//# sourceMappingURL=file.js.map
/***/ }),
/***/ "./node_modules/.pnpm/@wordpress+icons@11.2.0_react@18.3.1/node_modules/@wordpress/icons/build-module/library/link.js":
/*!****************************************************************************************************************************!*\
!*** ./node_modules/.pnpm/@wordpress+icons@11.2.0_react@18.3.1/node_modules/@wordpress/icons/build-module/library/link.js ***!
\****************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ link_default)
/* harmony export */ });
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
// packages/icons/src/library/link.tsx
var link_default = /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) });
//# sourceMappingURL=link.js.map
/***/ }),
/***/ "./src/document-card/block.json":
/*!**************************************!*\
!*** ./src/document-card/block.json ***!
\**************************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/document-card","version":"0.1.0","title":"Document Card","category":"carhop-blocks","icon":"smiley","description":"Document Card pour la mise en forme supérieure d\'éléments de contenu","example":{},"supports":{"html":false,"color":{"text":true,"background":false,"link":false}},"textdomain":"document-card","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"isInitilized":{"type":"boolean","default":false},"documentType":{"type":"string","default":"document","enum":["internal","external"]},"documentFileSize":{"type":"number","default":0},"documentUrl":{"type":"string","default":""},"documentId":{"type":"number","default":0},"UserhasValidatedExternalUrl":{"type":"boolean","default":false}}}');
/***/ }),
/***/ "./src/document-card/edit.js":
/*!***********************************!*\
!*** ./src/document-card/edit.js ***!
\***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ Edit)
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* 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_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/.pnpm/@wordpress+icons@11.2.0_react@18.3.1/node_modules/@wordpress/icons/build-module/library/file.js");
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/.pnpm/@wordpress+icons@11.2.0_react@18.3.1/node_modules/@wordpress/icons/build-module/library/link.js");
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./editor.scss */ "./src/document-card/editor.scss");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__);
function Edit({
attributes,
setAttributes
}) {
const {
isInitilized,
documentType,
documentUrl,
documentId,
UserhasValidatedExternalUrl,
documentFileSize
} = attributes;
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
className: "document-card"
});
const hasDocument = documentType === "internal" && documentId && documentUrl || documentType === "external" && documentUrl && UserhasValidatedExternalUrl;
const resetDocument = () => {
setAttributes({
documentId: 0,
documentUrl: "",
documentFileSize: 0,
isInitilized: false,
UserhasValidatedExternalUrl: false
});
};
const setInternalDocument = media => {
const fileSize = media.filesizeInBytes || 0;
const fileSizeInKB = Math.round(fileSize / 1024);
setAttributes({
documentType: "internal",
documentFileSize: fileSizeInKB,
documentId: media.id,
documentUrl: media.url,
isInitilized: true
});
};
const setExternalDocument = url => {
setAttributes({
documentType: "external",
documentFileSize: 0,
documentId: 0,
documentUrl: url,
isInitilized: true
});
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Type de document", "carhop-blocks"),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, {
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Document relié", "carhop-blocks"),
value: documentType,
onChange: value => {
setAttributes({
documentType: value,
isInitilized: true
});
resetDocument();
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, {
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("PDF interne", "carhop-blocks"),
value: "internal"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControlOption, {
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Lien externe", "carhop-blocks"),
value: "external"
})]
}), documentType === "external" && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, {
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("URL du document", "carhop-blocks"),
value: documentUrl,
onChange: value => setExternalDocument(value),
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("https://example.com/document.pdf", "carhop-blocks")
})
}), documentType === "internal" && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUploadCheck, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUpload, {
onSelect: media => {
setInternalDocument(media);
},
allowedTypes: ["application/pdf"],
value: documentId,
render: ({
open
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: documentUrl ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "document-card__media-preview",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", {
style: {
width: 48,
height: 48,
display: "flex",
alignItems: "center"
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Icon, {
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"]
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", {
className: "document-card__media-filename",
children: documentUrl.split("/").pop()?.split("?")[0] || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Document", "carhop-blocks")
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
style: {
marginTop: 8
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, {
variant: "secondary",
onClick: open,
style: {
marginRight: 8
},
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Remplacer", "carhop-blocks")
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, {
variant: "tertiary",
isDestructive: true,
onClick: () => resetDocument(),
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Supprimer", "carhop-blocks")
})]
})]
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, {
variant: "secondary",
onClick: open,
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Choisir un document", "carhop-blocks")
})
})
})
})]
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
...blockProps,
children: [!isInitilized && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Placeholder, {
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"],
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Document Card", "carhop-blocks"),
instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Choisissez le type de document que vous souhaitez afficher.", "carhop-blocks"),
className: "document-card__initialization",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalHStack, {
spacing: 3,
alignment: "stretch",
expanded: false,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, {
variant: "primary",
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["default"],
onClick: () => setAttributes({
isInitilized: true,
documentType: "internal"
}),
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("PDF interne", "carhop-blocks")
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, {
variant: "secondary",
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["default"],
onClick: () => setAttributes({
isInitilized: true,
documentType: "external"
}),
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Lien externe", "carhop-blocks")
})]
})
}), isInitilized && documentType === "internal" && !documentId && !documentUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaPlaceholder, {
icon: "media-default",
labels: {
title: "Fichier",
instructions: "Glissez-déposez, téléversez ou sélectionnez un fichier depuis votre médiathèque."
},
onSelect: media => setInternalDocument(media),
accept: "application/pdf",
allowedTypes: ["application/pdf"],
multiple: false
}), isInitilized && documentType === "external" && !UserhasValidatedExternalUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Placeholder, {
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["default"],
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Lien externe", "carhop-blocks"),
instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Entrez l'URL du document (PDF, etc.) ou utilisez le panneau de réglages à droite.", "carhop-blocks"),
className: "document-card__url-placeholder",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, {
value: documentUrl,
onChange: value => setExternalDocument(value),
placeholder: "https://example.com/document.pdf",
style: {
minWidth: 320
}
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, {
variant: "secondary",
onClick: () => setAttributes({
UserhasValidatedExternalUrl: true
}),
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Valider le lien", "carhop-blocks")
})]
}), hasDocument && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.BlockControls, {
group: "other",
children: [documentType === "internal" ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaReplaceFlow, {
mediaId: documentId,
mediaUrl: documentUrl,
allowedTypes: ["application/pdf"],
accept: "application/pdf",
onSelect: media => setInternalDocument(media),
name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Remplacer le document", "carhop-blocks")
}) : null, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton, {
onClick: () => resetDocument(),
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Supprimer le document", "carhop-blocks")
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
className: "document-card__preview",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "document-card__content",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks, {
allowedBlocks: ["core/heading", "core/paragraph", "core/list", "core/button", "core/buttons", "core/image", "core/embed", "core/quote", "core/pullquote", "core/media-text", "core/table", "core/group", "core/columns", "core/post-title", "carhop-blocks/cta", "carhop-blocks/heading", "carhop-blocks/cta-group", "carhop-blocks/audio-player", "carhop-blocks/content-box", "carhop-blocks/notice-panel", "shortcode"],
template: [["carhop-blocks/heading", {}, [["core/heading", {
content: "Titre du document",
placeholder: "Saisir le titre"
}], ["core/paragraph", {
content: "Sous-titre du document",
placeholder: "Saisir le sous-titre"
}]]]]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "file_info",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
className: "file_info__type",
children: documentType === "internal" ? "PDF" : "Document externe"
}), documentFileSize > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "file_info__size",
children: ["( ", documentFileSize, " Ko )"]
})]
})]
})
})]
})]
})]
});
}
/***/ }),
/***/ "./src/document-card/editor.scss":
/*!***************************************!*\
!*** ./src/document-card/editor.scss ***!
\***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/document-card/index.js":
/*!************************************!*\
!*** ./src/document-card/index.js ***!
\************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/document-card/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/document-card/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/document-card/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/document-card/block.json");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
context: "list-view",
"aria-hidden": "true",
focusable: "false",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
"fill-rule": "evenodd",
"clip-rule": "evenodd",
fill: "#146E63",
d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
})
})
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});
/***/ }),
/***/ "./src/document-card/save.js":
/*!***********************************!*\
!*** ./src/document-card/save.js ***!
\***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ save)
/* harmony export */ });
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
function save({
attributes
}) {
const {
documentUrl,
documentType,
documentFileSize
} = attributes;
const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save({
className: "document-card"
});
if (!documentUrl) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", {
...blockProps,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.InnerBlocks.Content, {})
});
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("a", {
...blockProps,
href: documentUrl,
target: "_blank",
rel: "noopener noreferrer",
className: `${blockProps.className || ""} document-card--${documentType}`,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", {
className: "document-card__content",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.InnerBlocks.Content, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", {
className: "file_info",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", {
className: "file_info__type",
children: documentType === "internal" ? "PDF" : "Document externe"
}), documentFileSize > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", {
className: "file_info__size",
children: ["( ", documentFileSize, " KB )"]
})]
})]
})
});
}
/***/ }),
/***/ "./src/document-card/style.scss":
/*!**************************************!*\
!*** ./src/document-card/style.scss ***!
\**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "@wordpress/block-editor":
/*!*************************************!*\
!*** external ["wp","blockEditor"] ***!
\*************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockEditor"];
/***/ }),
/***/ "@wordpress/blocks":
/*!********************************!*\
!*** external ["wp","blocks"] ***!
\********************************/
/***/ ((module) => {
module.exports = window["wp"]["blocks"];
/***/ }),
/***/ "@wordpress/components":
/*!************************************!*\
!*** external ["wp","components"] ***!
\************************************/
/***/ ((module) => {
module.exports = window["wp"]["components"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["i18n"];
/***/ }),
/***/ "@wordpress/primitives":
/*!************************************!*\
!*** external ["wp","primitives"] ***!
\************************************/
/***/ ((module) => {
module.exports = window["wp"]["primitives"];
/***/ }),
/***/ "react/jsx-runtime":
/*!**********************************!*\
!*** external "ReactJSXRuntime" ***!
\**********************************/
/***/ ((module) => {
module.exports = window["ReactJSXRuntime"];
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "document-card/index": 0,
/******/ "document-card/style-index": 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = globalThis["webpackChunkcarhop_blocks"] = globalThis["webpackChunkcarhop_blocks"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["document-card/style-index"], () => (__webpack_require__("./src/document-card/index.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
/*!**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/document-card/style.scss ***!
\**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/

View File

@ -0,0 +1,4 @@
/*!**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/document-card/style.scss ***!
\**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/

View File

@ -1,17 +1,17 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "dynamiques-blocks/explore-tags",
"name": "carhop-blocks/explore-tags",
"version": "0.1.0",
"title": "Explore Tags",
"category": "dynamiques-blocks",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"example": {},
"supports": {
"html": false
},
"textdomain": "explore-tags",
"textdomain": "carhop-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",

View File

@ -1,5 +1,5 @@
/*!**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.2_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/editor.scss ***!
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/editor.scss ***!
\**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied inside the editor only.

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n', 'wp-server-side-render'), 'version' => '94f81f006f4709bc7968');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n', 'wp-server-side-render'), 'version' => 'ea4b90607e6ac8f10cfd');

View File

@ -1,5 +1,5 @@
/*!**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.2_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/editor.scss ***!
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/editor.scss ***!
\**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied inside the editor only.

View File

@ -0,0 +1 @@
{"version":3,"file":"explore-tags/index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://carhop-blocks/./src/explore-tags/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-explore-tags {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -8,7 +8,7 @@
\*************************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"dynamiques-blocks/explore-tags","version":"0.1.0","title":"Explore Tags","category":"dynamiques-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"explore-tags","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php"}');
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/explore-tags","version":"0.1.0","title":"Explore Tags","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"}');
/***/ }),
@ -42,7 +42,7 @@ function Edit(props) {
className: "alignfull"
}),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)((_wordpress_server_side_render__WEBPACK_IMPORTED_MODULE_2___default()), {
block: "dynamiques-blocks/explore-tags",
block: "carhop-blocks/explore-tags",
attributes: props.attributes
})
});
@ -359,7 +359,7 @@ module.exports = window["ReactJSXRuntime"];
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = globalThis["webpackChunkdynamiques_blocks"] = globalThis["webpackChunkdynamiques_blocks"] || [];
/******/ var chunkLoadingGlobal = globalThis["webpackChunkcarhop_blocks"] = globalThis["webpackChunkcarhop_blocks"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,99 @@
<?php
if (!function_exists('explore_tags_get_post_types')) {
function explore_tags_get_post_types()
{
$current_blog_id = get_current_blog_id();
if ($current_blog_id === 2) {
return ['articles'];
}
if ($current_blog_id === 1 && is_page()) {
$tax = get_taxonomy('etiquettes');
return $tax->object_type ?? [];
}
// Single ou archive d'un post type
if (is_singular()) {
return [get_post_type()];
}
if (is_post_type_archive()) {
$post_type = get_query_var('post_type');
return is_array($post_type) ? $post_type : [$post_type];
}
return [];
}
}
if (!function_exists('explore_tags_get_post_ids')) {
function explore_tags_get_post_ids($post_types, $limit = 5000)
{
if (empty($post_types)) {
return [];
}
return get_posts([
'post_type' => $post_types,
'post_status' => 'publish',
'fields' => 'ids',
'posts_per_page' => $limit,
'no_found_rows' => true,
]);
}
}
if (!function_exists('explore_tags_get_tags_url')) {
function explore_tags_get_tags_url($tag)
{
$current_blog_id = get_current_blog_id();
if ($current_blog_id === 2) {
return add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles'));
}
if (is_page()) {
$link = get_term_link($tag);
return !is_wp_error($link) ? $link : '#';
}
return add_query_arg('etiquette', $tag->slug, get_post_type_archive_link(get_post_type()));
}
}
$post_types = explore_tags_get_post_types();
$args = [
'taxonomy' => 'etiquettes',
'hide_empty' => false,
];
if (!empty($post_types)) {
$post_ids = explore_tags_get_post_ids($post_types);
if (!empty($post_ids)) {
$args['object_ids'] = $post_ids;
}
}
$tags = get_terms($args);
?>
<section class="explore-tags alignfull">
<div class="inner">
<div class="explore-tags__titling">
<h2 class="explore-tags__title title-small">Tags</h2>
<h3 class="explore-tags__subtitle subtitle-big">Explorer <br /> par Tags</h3>
</div>
<div class="tag-list">
<?php foreach ($tags as $tag) : ?>
<a href="<?php echo esc_url(explore_tags_get_tags_url($tag)); ?>" class="tag-list__tag">
<?php echo $tag->name; ?>
<?php
$svg_path = get_template_directory() . '/resources/img/carhop-fleche-lien-externe-full.svg';
if (file_exists($svg_path)) {
echo file_get_contents($svg_path);
}
?>
</a>
<?php endforeach; ?>
</div>
</div>
</section>

View File

@ -1,5 +1,5 @@
/*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.2_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/style.scss ***!
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/style.scss ***!
\*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied both on the front of your site

View File

@ -1,5 +1,5 @@
/*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.2_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/style.scss ***!
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/explore-tags/style.scss ***!
\*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied both on the front of your site

View File

@ -0,0 +1 @@
{"version":3,"file":"explore-tags/style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://carhop-blocks/./src/explore-tags/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-explore-tags {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -0,0 +1,25 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "carhop-blocks/tab-group",
"version": "0.1.0",
"title": "Tab Group",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Tab Group pour la mise en forme supérieure d'éléments de contenu",
"example": {},
"supports": {
"html": false,
"color": {
"text": true,
"background": false,
"link": false
}
},
"textdomain": "tab-group",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"render": "file:./render.php"
}

View File

@ -0,0 +1,11 @@
/*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab-group/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-chapo {
border: 1px dotted #f00;
}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-data', 'wp-i18n'), 'version' => '683d2174b11aebcc2090');

View File

@ -0,0 +1,13 @@
/*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab-group/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-chapo {
border: 1px dotted #f00;
}
/*# sourceMappingURL=index.css.map*/

View File

@ -0,0 +1 @@
{"version":3,"file":"tab-group/index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://carhop-blocks/./src/tab-group/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-chapo {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -0,0 +1,395 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/tab-group/block.json":
/*!**********************************!*\
!*** ./src/tab-group/block.json ***!
\**********************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/tab-group","version":"0.1.0","title":"Tab Group","category":"carhop-blocks","icon":"smiley","description":"Tab Group pour la mise en forme supérieure d\'éléments de contenu","example":{},"supports":{"html":false,"color":{"text":true,"background":false,"link":false}},"textdomain":"tab-group","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php"}');
/***/ }),
/***/ "./src/tab-group/edit.js":
/*!*******************************!*\
!*** ./src/tab-group/edit.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ Edit)
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* 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_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/tab-group/editor.scss");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
function Edit({
attributes,
setAttributes,
clientId
}) {
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
className: "tab-group"
});
const tabs = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)(select => {
const block = select("core/block-editor").getBlock(clientId);
if (!block?.innerBlocks) return [];
return block.innerBlocks.map((innerBlock, index) => ({
id: `tab-${index + 1}`,
panelId: `tabpanel-${index + 1}`,
title: innerBlock.attributes?.title || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Sans titre", "tab-group"),
iconUrl: innerBlock.attributes?.iconUrl || ""
}));
}, [clientId]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("section", {
...blockProps,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
className: "tab-group__toolbar",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
role: "tablist",
"aria-labelledby": "tablist-1",
className: "tablist",
children: tabs.map((tab, index) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("button", {
id: tab.id,
type: "button",
role: "tab",
"aria-selected": index === 0,
"aria-controls": tab.panelId,
tabIndex: index === 0 ? 0 : -1,
"data-tab": index,
children: [tab.iconUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {
src: tab.iconUrl,
alt: "",
className: "tab__icon",
"aria-hidden": true
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
children: tab.title
})]
}, tab.id))
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks, {
allowedBlocks: ["carhop-blocks/tab"],
template: [["carhop-blocks/tab"]]
})]
});
}
/***/ }),
/***/ "./src/tab-group/editor.scss":
/*!***********************************!*\
!*** ./src/tab-group/editor.scss ***!
\***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/tab-group/index.js":
/*!********************************!*\
!*** ./src/tab-group/index.js ***!
\********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/tab-group/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/tab-group/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/tab-group/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/tab-group/block.json");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "64",
height: "64",
viewBox: "0 0 64 64",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M46,10H8c-2.1,0-4.2.8-5.7,2.3s-2.3,3.5-2.3,5.7v38c0,2.1.8,4.2,2.3,5.7s3.5,2.3,5.7,2.3h38c2.1,0,4.2-.8,5.7-2.3s2.3-3.5,2.3-5.7V18c0-2.1-.8-4.2-2.3-5.7s-3.5-2.3-5.7-2.3ZM25.8,18.3c.5-.5,1.3-.8,2-.8h0c1.1,0,2.2.7,2.6,1.8.4,1.1.2,2.3-.6,3.1s-2,1.1-3.1.6c-1.1-.4-1.7-1.5-1.8-2.6,0-.8.3-1.5.8-2ZM19.5,17.5c1.1,0,2.2.7,2.6,1.8.4,1.1.2,2.3-.6,3.1s-2,1.1-3.1.6c-1.1-.4-1.7-1.5-1.8-2.6,0-1.6,1.3-2.8,2.8-2.8ZM11.2,17.5c1.6,0,2.8,1.3,2.8,2.8s-1.3,2.8-2.8,2.8-2.8-1.3-2.8-2.8,1.3-2.8,2.8-2.8ZM50,56c0,2.2-1.8,4-4,4H8c-2.2,0-4-1.8-4-4v-25.3h46v25.3ZM61.7,2.3C60.2.8,58.1,0,56,0H18C15.9,0,13.8.8,12.3,2.3s-2.3,3.5-2.3,5.7h36c5.5,0,10,4.5,10,10v36c2.1,0,4.2-.8,5.7-2.3s2.3-3.5,2.3-5.7V8c0-2.1-.8-4.2-2.3-5.7Z",
fill: "#146E63"
})
})
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});
/***/ }),
/***/ "./src/tab-group/save.js":
/*!*******************************!*\
!*** ./src/tab-group/save.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ save)
/* harmony export */ });
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
function save() {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.InnerBlocks.Content, {});
}
/***/ }),
/***/ "./src/tab-group/style.scss":
/*!**********************************!*\
!*** ./src/tab-group/style.scss ***!
\**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "@wordpress/block-editor":
/*!*************************************!*\
!*** external ["wp","blockEditor"] ***!
\*************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockEditor"];
/***/ }),
/***/ "@wordpress/blocks":
/*!********************************!*\
!*** external ["wp","blocks"] ***!
\********************************/
/***/ ((module) => {
module.exports = window["wp"]["blocks"];
/***/ }),
/***/ "@wordpress/data":
/*!******************************!*\
!*** external ["wp","data"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["data"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["i18n"];
/***/ }),
/***/ "react/jsx-runtime":
/*!**********************************!*\
!*** external "ReactJSXRuntime" ***!
\**********************************/
/***/ ((module) => {
module.exports = window["ReactJSXRuntime"];
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "tab-group/index": 0,
/******/ "tab-group/style-index": 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = globalThis["webpackChunkcarhop_blocks"] = globalThis["webpackChunkcarhop_blocks"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["tab-group/style-index"], () => (__webpack_require__("./src/tab-group/index.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,48 @@
<?php
$wrapper_attributes = get_block_wrapper_attributes(['class' => 'tab-group']);
$inner_blocks = $block->parsed_block['innerBlocks'] ?? [];
// Extraire les titres et icônes des blocs tab pour les boutons
$tabs = array_map(function ($inner_block) {
return [
'title' => $inner_block['attrs']['title'] ?? __('Sans titre', 'tab-group'),
'iconUrl' => $inner_block['attrs']['iconUrl'] ?? '',
];
}, array_filter($inner_blocks, fn($b) => ($b['blockName'] ?? '') === 'carhop-blocks/tab'));
?>
<section <?php echo $wrapper_attributes; ?>>
<div class="tab-group__toolbar">
<div role="tablist" aria-label="<?php esc_attr_e('Onglets', 'tab-group'); ?>" class="tablist">
<?php foreach ($tabs as $index => $tab) : ?>
<button
type="button"
role="tab"
aria-selected="<?php echo $index === 0 ? 'true' : 'false'; ?>"
aria-controls="tabpanel-<?php echo esc_attr($index + 1); ?>"
tabindex="<?php echo $index === 0 ? '0' : '-1'; ?>"
data-tab="<?php echo esc_attr($index); ?>">
<?php if (!empty($tab['iconUrl'])) : ?>
<img src="<?php echo esc_url($tab['iconUrl']); ?>" alt="" class="tab__icon" aria-hidden />
<?php endif; ?>
<span><?php echo esc_html($tab['title']); ?></span>
</button>
<?php endforeach; ?>
</div>
</div>
<div class="tab-group__innerblocks">
<?php foreach ($inner_blocks as $index => $inner_block) : ?>
<div class="wp-block-carhop-blocks-tab tab" id="tabpanel-<?php echo esc_attr($index + 1); ?>" role="tabpanel" data-active="<?php echo $index === 0 ? 'true' : 'false'; ?>">
<?php echo render_block($inner_block); ?>
</div>
<?php endforeach; ?>
</div>
</section>

View File

@ -0,0 +1,37 @@
/*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab-group/style.scss ***!
\**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
.tab__title {
margin-bottom: 2rem;
}
.tablist button {
gap: 10px !important;
}
.tablist button[aria-selected=false] img {
filter: grayscale(100%);
}
.tab-group__toolbar {
margin-bottom: 2rem;
}
.tablist .tab__icon {
--iconSize: 1.5rem;
width: var(--iconSize);
height: var(--iconSize);
-o-object-fit: contain;
object-fit: contain;
-o-object-position: center;
object-position: center;
vertical-align: middle;
}
.wp-block-carhop-blocks-tab[data-active=false] {
display: none;
}
.wp-block-carhop-blocks-tab[data-active=true] {
display: block !important;
}

View File

@ -0,0 +1,39 @@
/*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab-group/style.scss ***!
\**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
.tab__title {
margin-bottom: 2rem;
}
.tablist button {
gap: 10px !important;
}
.tablist button[aria-selected=false] img {
filter: grayscale(100%);
}
.tab-group__toolbar {
margin-bottom: 2rem;
}
.tablist .tab__icon {
--iconSize: 1.5rem;
width: var(--iconSize);
height: var(--iconSize);
-o-object-fit: contain;
object-fit: contain;
-o-object-position: center;
object-position: center;
vertical-align: middle;
}
.wp-block-carhop-blocks-tab[data-active=false] {
display: none;
}
.wp-block-carhop-blocks-tab[data-active=true] {
display: block !important;
}
/*# sourceMappingURL=style-index.css.map*/

View File

@ -0,0 +1 @@
{"version":3,"file":"tab-group/style-index.css","mappings":";;;AAAA;EACC;AACD;;AAGC;EACC;AAAF;;AAGE;EACC;AADH;;AAMA;EACC;AAHD;;AAMA;EACC;EAEA;EACA;EAEA;KAAA;EACA;KAAA;EACA;AALD;;AAQA;EACC;AALD;;AAOA;EACC;AAJD,C","sources":["webpack://carhop-blocks/./src/tab-group/style.scss"],"sourcesContent":[".tab__title {\n\tmargin-bottom: 2rem;\n}\n\n.tablist {\n\tbutton {\n\t\tgap: 10px !important;\n\t}\n\tbutton[aria-selected=\"false\"] {\n\t\timg {\n\t\t\tfilter: grayscale(100%);\n\t\t}\n\t}\n}\n\n.tab-group__toolbar {\n\tmargin-bottom: 2rem;\n}\n\n.tablist .tab__icon {\n\t--iconSize: 1.5rem;\n\n\twidth: var(--iconSize);\n\theight: var(--iconSize);\n\t// background: blue;\n\tobject-fit: contain;\n\tobject-position: center;\n\tvertical-align: middle;\n}\n\n.wp-block-carhop-blocks-tab[data-active=\"false\"] {\n\tdisplay: none;\n}\n.wp-block-carhop-blocks-tab[data-active=\"true\"] {\n\tdisplay: block !important;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => 'fb50ed7f9d196565c95a');

View File

@ -0,0 +1,38 @@
/******/ (() => { // webpackBootstrap
/*!*******************************!*\
!*** ./src/tab-group/view.js ***!
\*******************************/
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".tab-group").forEach(TabGroup => {
const toolbar = TabGroup.querySelector(".tab-group__toolbar");
const tabs = toolbar.querySelectorAll("button");
function setActiveTab(currentTab) {
tabs.forEach(tab => {
tab.setAttribute("aria-selected", "false");
});
currentTab.setAttribute("aria-selected", "true");
}
function setActiveTabPanel(currentTabButton) {
const currentTabPanelId = currentTabButton.getAttribute("aria-controls");
const currentTabPanel = TabGroup.querySelector(`#${currentTabPanelId}`);
console.log(currentTabPanel);
hideAllTabPanels();
currentTabPanel.setAttribute("data-active", "true");
}
function hideAllTabPanels() {
const tabPanels = TabGroup.querySelectorAll(".tab-group__innerblocks .tab");
tabPanels.forEach(tabPanel => {
tabPanel.setAttribute("data-active", "false");
});
}
tabs.forEach(tab => {
tab.addEventListener("click", () => {
setActiveTab(tab);
setActiveTabPanel(tab);
});
});
});
});
/******/ })()
;
//# sourceMappingURL=view.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"tab-group/view.js","mappings":";;;;AAAAA,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM;EACnDD,QAAQ,CAACE,gBAAgB,CAAC,YAAY,CAAC,CAACC,OAAO,CAAEC,QAAQ,IAAK;IAC7D,MAAMC,OAAO,GAAGD,QAAQ,CAACE,aAAa,CAAC,qBAAqB,CAAC;IAC7D,MAAMC,IAAI,GAAGF,OAAO,CAACH,gBAAgB,CAAC,QAAQ,CAAC;IAE/C,SAASM,YAAYA,CAACC,UAAU,EAAE;MACjCF,IAAI,CAACJ,OAAO,CAAEO,GAAG,IAAK;QACrBA,GAAG,CAACC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC;MAC3C,CAAC,CAAC;MACFF,UAAU,CAACE,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC;IACjD;IACA,SAASC,iBAAiBA,CAACC,gBAAgB,EAAE;MAC5C,MAAMC,iBAAiB,GAAGD,gBAAgB,CAACE,YAAY,CAAC,eAAe,CAAC;MACxE,MAAMC,eAAe,GAAGZ,QAAQ,CAACE,aAAa,CAAC,IAAIQ,iBAAiB,EAAE,CAAC;MACvEG,OAAO,CAACC,GAAG,CAACF,eAAe,CAAC;MAC5BG,gBAAgB,CAAC,CAAC;MAClBH,eAAe,CAACL,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC;IACpD;IACA,SAASQ,gBAAgBA,CAAA,EAAG;MAC3B,MAAMC,SAAS,GAAGhB,QAAQ,CAACF,gBAAgB,CAC1C,8BACD,CAAC;MACDkB,SAAS,CAACjB,OAAO,CAAEkB,QAAQ,IAAK;QAC/BA,QAAQ,CAACV,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC;MAC9C,CAAC,CAAC;IACH;IACAJ,IAAI,CAACJ,OAAO,CAAEO,GAAG,IAAK;MACrBA,GAAG,CAACT,gBAAgB,CAAC,OAAO,EAAE,MAAM;QACnCO,YAAY,CAACE,GAAG,CAAC;QACjBE,iBAAiB,CAACF,GAAG,CAAC;MACvB,CAAC,CAAC;IACH,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://carhop-blocks/./src/tab-group/view.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", () => {\n\tdocument.querySelectorAll(\".tab-group\").forEach((TabGroup) => {\n\t\tconst toolbar = TabGroup.querySelector(\".tab-group__toolbar\");\n\t\tconst tabs = toolbar.querySelectorAll(\"button\");\n\n\t\tfunction setActiveTab(currentTab) {\n\t\t\ttabs.forEach((tab) => {\n\t\t\t\ttab.setAttribute(\"aria-selected\", \"false\");\n\t\t\t});\n\t\t\tcurrentTab.setAttribute(\"aria-selected\", \"true\");\n\t\t}\n\t\tfunction setActiveTabPanel(currentTabButton) {\n\t\t\tconst currentTabPanelId = currentTabButton.getAttribute(\"aria-controls\");\n\t\t\tconst currentTabPanel = TabGroup.querySelector(`#${currentTabPanelId}`);\n\t\t\tconsole.log(currentTabPanel);\n\t\t\thideAllTabPanels();\n\t\t\tcurrentTabPanel.setAttribute(\"data-active\", \"true\");\n\t\t}\n\t\tfunction hideAllTabPanels() {\n\t\t\tconst tabPanels = TabGroup.querySelectorAll(\n\t\t\t\t\".tab-group__innerblocks .tab\",\n\t\t\t);\n\t\t\ttabPanels.forEach((tabPanel) => {\n\t\t\t\ttabPanel.setAttribute(\"data-active\", \"false\");\n\t\t\t});\n\t\t}\n\t\ttabs.forEach((tab) => {\n\t\t\ttab.addEventListener(\"click\", () => {\n\t\t\t\tsetActiveTab(tab);\n\t\t\t\tsetActiveTabPanel(tab);\n\t\t\t});\n\t\t});\n\t});\n});\n"],"names":["document","addEventListener","querySelectorAll","forEach","TabGroup","toolbar","querySelector","tabs","setActiveTab","currentTab","tab","setAttribute","setActiveTabPanel","currentTabButton","currentTabPanelId","getAttribute","currentTabPanel","console","log","hideAllTabPanels","tabPanels","tabPanel"],"ignoreList":[],"sourceRoot":""}

View File

@ -0,0 +1,30 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "carhop-blocks/tab",
"version": "0.1.0",
"title": "Tab",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Tab pour la mise en forme supérieure d'éléments de contenu",
"example": {},
"supports": {
"html": false,
"color": {
"text": true,
"background": false,
"link": false
}
},
"textdomain": "tab",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"title": {
"type": "string",
"default": ""
}
}
}

View File

@ -0,0 +1,11 @@
/*!*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab/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-chapo {
border: 1px dotted #f00;
}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'f0707b941eb4f50b49b3');

View File

@ -0,0 +1,13 @@
/*!*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab/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-chapo {
border: 1px dotted #f00;
}
/*# sourceMappingURL=index.css.map*/

View File

@ -0,0 +1 @@
{"version":3,"file":"tab/index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://carhop-blocks/./src/tab/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-chapo {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -0,0 +1,454 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/tab/block.json":
/*!****************************!*\
!*** ./src/tab/block.json ***!
\****************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"carhop-blocks/tab","version":"0.1.0","title":"Tab","category":"carhop-blocks","icon":"smiley","description":"Tab pour la mise en forme supérieure d\'éléments de contenu","example":{},"supports":{"html":false,"color":{"text":true,"background":false,"link":false}},"textdomain":"tab","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"title":{"type":"string","default":""}}}');
/***/ }),
/***/ "./src/tab/edit.js":
/*!*************************!*\
!*** ./src/tab/edit.js ***!
\*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ Edit)
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* 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 _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/tab/editor.scss");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
function Edit({
attributes,
setAttributes
}) {
const {
title,
iconId,
iconUrl
} = attributes;
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
className: "block-chapo"
});
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__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, {
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Tab", "carhop-blocks"),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TextControl, {
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Titre", "carhop-blocks"),
value: title,
onChange: value => setAttributes({
title: value
})
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, {
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Icône", "carhop-blocks"),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUploadCheck, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUpload, {
onSelect: media => setAttributes({
iconId: media.id,
iconUrl: media.url
}),
allowedTypes: ["image"],
value: iconId,
render: ({
open
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
children: iconUrl ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
className: "tab__icon-preview",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {
src: iconUrl,
alt: "",
style: {
maxWidth: 48,
height: "auto"
}
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
style: {
marginTop: 8
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
variant: "secondary",
onClick: open,
style: {
marginRight: 8
},
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Remplacer", "carhop-blocks")
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
variant: "tertiary",
isDestructive: true,
onClick: () => setAttributes({
iconId: 0,
iconUrl: ""
}),
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Supprimer", "carhop-blocks")
})]
})]
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
variant: "secondary",
onClick: open,
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Choisir une image", "carhop-blocks")
})
})
})
})
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
...blockProps,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText, {
tagName: "h2",
className: "tab__title",
placeholder: "Titre",
value: title,
onChange: value => setAttributes({
title: value
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks, {
allowedBlocks: ["core/heading", "core/paragraph", "core/list", "core/button", "core/buttons", "core/image", "core/embed", "core/quote", "core/pullquote", "core/media-text", "core/table", "core/group", "core/columns", "core/post-title", "carhop-blocks/cta", "carhop-blocks/heading", "carhop-blocks/cta-group", "carhop-blocks/audio-player", "carhop-blocks/content-box", "carhop-blocks/notice-panel", "shortcode"],
template: [["core/paragraph", {
content: "Contenu"
}]]
})]
})]
});
}
/***/ }),
/***/ "./src/tab/editor.scss":
/*!*****************************!*\
!*** ./src/tab/editor.scss ***!
\*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/tab/index.js":
/*!**************************!*\
!*** ./src/tab/index.js ***!
\**************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/tab/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/tab/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/tab/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/tab/block.json");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "83.3",
height: "83.3",
viewBox: "0 0 83.3 83.3",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
fill: "#146E63",
d: "M72.7,0H10.7C4.8,0,0,4.8,0,10.7v62c0,5.9,4.8,10.7,10.7,10.7h62c5.9,0,10.7-4.8,10.7-10.7V10.7c0-5.9-4.8-10.7-10.7-10.7ZM10.7,5.8h62c2.7,0,4.8,2.2,4.8,4.8v8.7H5.8v-8.7c0-2.7,2.2-4.8,4.8-4.8ZM72.7,77.5H10.7c-2.7,0-4.8-2.2-4.8-4.8V25.2h71.7v47.5c0,1.3-.5,2.5-1.4,3.4s-2.1,1.4-3.4,1.4h0ZM9.7,12.5c0-1.5,1.3-2.7,2.8-2.8h19.5c.8-.1,1.7.2,2.3.7.6.6,1,1.3,1,2.2s-.4,1.6-1,2.2c-.6.6-1.5.8-2.3.7H12.5c-.8,0-1.5-.4-2-.9-.5-.6-.8-1.3-.8-2.1h0Z"
})
})
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});
/***/ }),
/***/ "./src/tab/save.js":
/*!*************************!*\
!*** ./src/tab/save.js ***!
\*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ save)
/* harmony export */ });
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
function save({
attributes
}) {
const {
title
} = attributes;
const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save({
className: "tab"
});
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.RichText.Content, {
value: title,
tagName: "h2",
className: "tab__title"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.InnerBlocks.Content, {})]
});
}
/***/ }),
/***/ "./src/tab/style.scss":
/*!****************************!*\
!*** ./src/tab/style.scss ***!
\****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "@wordpress/block-editor":
/*!*************************************!*\
!*** external ["wp","blockEditor"] ***!
\*************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockEditor"];
/***/ }),
/***/ "@wordpress/blocks":
/*!********************************!*\
!*** external ["wp","blocks"] ***!
\********************************/
/***/ ((module) => {
module.exports = window["wp"]["blocks"];
/***/ }),
/***/ "@wordpress/components":
/*!************************************!*\
!*** external ["wp","components"] ***!
\************************************/
/***/ ((module) => {
module.exports = window["wp"]["components"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["i18n"];
/***/ }),
/***/ "react/jsx-runtime":
/*!**********************************!*\
!*** external "ReactJSXRuntime" ***!
\**********************************/
/***/ ((module) => {
module.exports = window["ReactJSXRuntime"];
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "tab/index": 0,
/******/ "tab/style-index": 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = globalThis["webpackChunkcarhop_blocks"] = globalThis["webpackChunkcarhop_blocks"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["tab/style-index"], () => (__webpack_require__("./src/tab/index.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
/*!****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab/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-chapo {
background-color: #21759b;
color: #fff;
padding: 2px;
}

View File

@ -0,0 +1,16 @@
/*!****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.11.0_webpack@5.103.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.5.6_webpack@5.103.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@16.0.6_sass@1.94.1_webpack@5.103.0/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/tab/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-chapo {
background-color: #21759b;
color: #fff;
padding: 2px;
}
/*# sourceMappingURL=style-index.css.map*/

View File

@ -0,0 +1 @@
{"version":3,"file":"tab/style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://carhop-blocks/./src/tab/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-chapo {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '9352c55c326c37be0285');

View File

@ -0,0 +1,32 @@
/******/ (() => { // webpackBootstrap
/*!*************************!*\
!*** ./src/tab/view.js ***!
\*************************/
/**
* Use this file for JavaScript code that you want to run in the front-end
* on posts/pages that contain this block.
*
* When this file is defined as the value of the `viewScript` property
* in `block.json` it will be enqueued on the front end of the site.
*
* Example:
*
* ```js
* {
* "viewScript": "file:./view.js"
* }
* ```
*
* If you're not making any changes to this file because your project doesn't need any
* JavaScript running in the front-end, then you should delete this file and remove
* the `viewScript` property from `block.json`.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script
*/
/* eslint-disable no-console */
console.log('Hello World! (from create-block-chapo block)');
/* eslint-enable no-console */
/******/ })()
;
//# sourceMappingURL=view.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"tab/view.js","mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACAA,OAAO,CAACC,GAAG,CAAE,8CAA+C,CAAC;AAC7D,8B","sources":["webpack://carhop-blocks/./src/tab/view.js"],"sourcesContent":["/**\n * Use this file for JavaScript code that you want to run in the front-end\n * on posts/pages that contain this block.\n *\n * When this file is defined as the value of the `viewScript` property\n * in `block.json` it will be enqueued on the front end of the site.\n *\n * Example:\n *\n * ```js\n * {\n * \"viewScript\": \"file:./view.js\"\n * }\n * ```\n *\n * If you're not making any changes to this file because your project doesn't need any\n * JavaScript running in the front-end, then you should delete this file and remove\n * the `viewScript` property from `block.json`.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script\n */\n\n/* eslint-disable no-console */\nconsole.log( 'Hello World! (from create-block-chapo block)' );\n/* eslint-enable no-console */\n"],"names":["console","log"],"ignoreList":[],"sourceRoot":""}

View File

@ -102,6 +102,10 @@ export default function Edit({ attributes, setAttributes, ...props }) {
value="backgrounded"
label="Fond coloré"
/>
<ToggleGroupControlOption
value="framed-backgrounded"
label="Cadre + fond coloré"
/>
</ToggleGroupControl>
<ToggleGroupControl
label="Largeur du bloc"
@ -116,37 +120,40 @@ export default function Edit({ attributes, setAttributes, ...props }) {
<ToggleGroupControlOption value="full" label="Pleine largeur" />
</ToggleGroupControl>
{blockVariant === "backgrounded" && (
<Card>
<CardHeader>
<h1>Couleur de fond</h1>
</CardHeader>
<CardBody>
<>
<ColorPalette
colors={filteredBgColors}
value={backgroundColor}
onChange={onBackgroundColorChange}
/>
</>
</CardBody>
</Card>
)}
{blockVariant === "backgrounded" ||
(blockVariant === "framed-backgrounded" && (
<Card>
<CardHeader>
<h1>Couleur de fond</h1>
</CardHeader>
<CardBody>
<>
<ColorPalette
colors={filteredBgColors}
value={backgroundColor}
onChange={onBackgroundColorChange}
/>
</>
</CardBody>
</Card>
))}
{blockVariant === "backgrounded" && postType !== "articles" && (
<Card>
<CardHeader>
<h1>Couleur du texte </h1>
</CardHeader>
<CardBody>
<ColorPalette
colors={filteredTextColors}
value={textColor}
onChange={onTextColorChange}
/>
</CardBody>
</Card>
)}
{(blockVariant === "backgrounded" ||
blockVariant === "framed-backgrounded") &&
postType !== "articles" && (
<Card>
<CardHeader>
<h1>Couleur du texte </h1>
</CardHeader>
<CardBody>
<ColorPalette
colors={filteredTextColors}
value={textColor}
onChange={onTextColorChange}
/>
</CardBody>
</Card>
)}
</PanelBody>
</InspectorControls>
<section
@ -162,7 +169,10 @@ export default function Edit({ attributes, setAttributes, ...props }) {
style: {
"--content-box-text-color": textColor ?? "inherit",
"--content-box-background-color":
blockVariant === "backgrounded" ? backgroundColor : "transparent",
blockVariant === "backgrounded" ||
blockVariant === "framed-backgrounded"
? backgroundColor
: "transparent",
},
})}
>
@ -180,6 +190,7 @@ export default function Edit({ attributes, setAttributes, ...props }) {
"core/image",
"core/buttons",
"core/columns",
"core/file",
"core/post-title",
"core/embed",
"core/quote",

View File

@ -20,7 +20,10 @@ export default function save({ attributes }) {
style: {
"--content-box-text-color": textColor ?? "inherit",
"--content-box-background-color":
blockVariant === "backgrounded" ? backgroundColor : "transparent",
blockVariant === "backgrounded" ||
blockVariant === "framed-backgrounded"
? backgroundColor
: "transparent",
},
})}
>

View File

@ -14,13 +14,12 @@ import { Tip } from "@wordpress/components";
import { ReactComponent as ArrowIcon } from "./img/carhop-fleche-lien-externe-full.svg";
export default function Edit({ attributes, setAttributes }) {
const { color } = attributes;
const { color, link } = attributes;
const colors = useSetting("color.palette.theme");
function handleColorChange(value) {
setAttributes({ color: value });
}
console.log(color);
return (
<>

View File

@ -3,9 +3,7 @@ $align = isset($attributes['align']) ? $attributes['align'] : '';
$link = isset($attributes['link']) ? $attributes['link'] : [];
$text = isset($attributes['text']) ? $attributes['text'] : '';
$color = isset($attributes['color']) ? $attributes['color'] : '';
$target = isset($link) && $link['opensInNewTab'] ? '_blank' : '_self';
$styles = [];
if ($color) {
@ -21,6 +19,6 @@ $wrapper_attributes = get_block_wrapper_attributes([
$link_url = isset($link['url']) ? esc_url($link['url']) : '#';
?>
<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?>>
<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?> target="<?php echo $target; ?>">
<?php echo esc_html($text); ?>
</a>

View File

@ -0,0 +1,54 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "carhop-blocks/document-card",
"version": "0.1.0",
"title": "Document Card",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Document Card pour la mise en forme supérieure d'éléments de contenu",
"example": {},
"supports": {
"html": false,
"color": {
"text": true,
"background": false,
"link": false
}
},
"textdomain": "document-card",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"isInitilized": {
"type": "boolean",
"default": false
},
"documentType": {
"type": "string",
"default": "document",
"enum": [
"internal",
"external"
]
},
"documentFileSize": {
"type": "number",
"default": 0
},
"documentUrl": {
"type": "string",
"default": ""
},
"documentId": {
"type": "number",
"default": 0
},
"UserhasValidatedExternalUrl": {
"type": "boolean",
"default": false
}
}
}

View File

@ -0,0 +1,342 @@
import { __ } from "@wordpress/i18n";
import {
useBlockProps,
InnerBlocks,
InspectorControls,
MediaUpload,
MediaUploadCheck,
BlockControls,
MediaReplaceFlow,
} from "@wordpress/block-editor";
import { __experimentalHStack as HStack } from "@wordpress/components";
import {
PanelBody,
TextControl,
Button,
Placeholder,
ToolbarButton,
Icon,
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
} from "@wordpress/components";
import { file, link, external } from "@wordpress/icons";
import { MediaPlaceholder } from "@wordpress/block-editor";
import "./editor.scss";
export default function Edit({ attributes, setAttributes }) {
const {
isInitilized,
documentType,
documentUrl,
documentId,
UserhasValidatedExternalUrl,
documentFileSize,
} = attributes;
const blockProps = useBlockProps({
className: "document-card",
});
const hasDocument =
(documentType === "internal" && documentId && documentUrl) ||
(documentType === "external" && documentUrl && UserhasValidatedExternalUrl);
const resetDocument = () => {
setAttributes({
documentId: 0,
documentUrl: "",
documentFileSize: 0,
isInitilized: false,
UserhasValidatedExternalUrl: false,
});
};
const setInternalDocument = (media) => {
const fileSize = media.filesizeInBytes || 0;
const fileSizeInKB = Math.round(fileSize / 1024);
setAttributes({
documentType: "internal",
documentFileSize: fileSizeInKB,
documentId: media.id,
documentUrl: media.url,
isInitilized: true,
});
};
const setExternalDocument = (url) => {
setAttributes({
documentType: "external",
documentFileSize: 0,
documentId: 0,
documentUrl: url,
isInitilized: true,
});
};
return (
<>
<InspectorControls>
<PanelBody title={__("Type de document", "carhop-blocks")}>
<ToggleGroupControl
label={__("Document relié", "carhop-blocks")}
value={documentType}
onChange={(value) => {
setAttributes({ documentType: value, isInitilized: true });
resetDocument();
}}
>
<ToggleGroupControlOption
label={__("PDF interne", "carhop-blocks")}
value="internal"
/>
<ToggleGroupControlOption
label={__("Lien externe", "carhop-blocks")}
value="external"
/>
</ToggleGroupControl>
{documentType === "external" && (
<>
<TextControl
label={__("URL du document", "carhop-blocks")}
value={documentUrl}
onChange={(value) => setExternalDocument(value)}
placeholder={__(
"https://example.com/document.pdf",
"carhop-blocks",
)}
/>
</>
)}
{documentType === "internal" && (
<MediaUploadCheck>
<MediaUpload
onSelect={(media) => {
setInternalDocument(media);
}}
allowedTypes={["application/pdf"]}
value={documentId}
render={({ open }) => (
<>
{documentUrl ? (
<div className="document-card__media-preview">
<span
style={{
width: 48,
height: 48,
display: "flex",
alignItems: "center",
}}
>
<Icon icon={file} />
</span>
<span className="document-card__media-filename">
{documentUrl.split("/").pop()?.split("?")[0] ||
__("Document", "carhop-blocks")}
</span>
<div style={{ marginTop: 8 }}>
<Button
variant="secondary"
onClick={open}
style={{ marginRight: 8 }}
>
{__("Remplacer", "carhop-blocks")}
</Button>
<Button
variant="tertiary"
isDestructive
onClick={() => resetDocument()}
>
{__("Supprimer", "carhop-blocks")}
</Button>
</div>
</div>
) : (
<Button variant="secondary" onClick={open}>
{__("Choisir un document", "carhop-blocks")}
</Button>
)}
</>
)}
/>
</MediaUploadCheck>
)}
</PanelBody>
</InspectorControls>
<div {...blockProps}>
{!isInitilized && (
<Placeholder
icon={file}
label={__("Document Card", "carhop-blocks")}
instructions={__(
"Choisissez le type de document que vous souhaitez afficher.",
"carhop-blocks",
)}
className="document-card__initialization"
>
<HStack spacing={3} alignment="stretch" expanded={false}>
<Button
variant="primary"
icon={file}
onClick={() =>
setAttributes({
isInitilized: true,
documentType: "internal",
})
}
>
{__("PDF interne", "carhop-blocks")}
</Button>
<Button
variant="secondary"
icon={link}
onClick={() =>
setAttributes({
isInitilized: true,
documentType: "external",
})
}
>
{__("Lien externe", "carhop-blocks")}
</Button>
</HStack>
</Placeholder>
)}
{isInitilized &&
documentType === "internal" &&
!documentId &&
!documentUrl && (
<MediaPlaceholder
icon="media-default"
labels={{
title: "Fichier",
instructions:
"Glissez-déposez, téléversez ou sélectionnez un fichier depuis votre médiathèque.",
}}
onSelect={(media) => setInternalDocument(media)}
accept="application/pdf"
allowedTypes={["application/pdf"]}
multiple={false}
/>
)}
{isInitilized &&
documentType === "external" &&
!UserhasValidatedExternalUrl && (
<Placeholder
icon={link}
label={__("Lien externe", "carhop-blocks")}
instructions={__(
"Entrez l'URL du document (PDF, etc.) ou utilisez le panneau de réglages à droite.",
"carhop-blocks",
)}
className="document-card__url-placeholder"
>
<TextControl
value={documentUrl}
onChange={(value) => setExternalDocument(value)}
placeholder="https://example.com/document.pdf"
style={{ minWidth: 320 }}
/>
<Button
variant="secondary"
onClick={() =>
setAttributes({ UserhasValidatedExternalUrl: true })
}
>
{__("Valider le lien", "carhop-blocks")}
</Button>
</Placeholder>
)}
{hasDocument && (
<>
<BlockControls group="other">
{documentType === "internal" ? (
<MediaReplaceFlow
mediaId={documentId}
mediaUrl={documentUrl}
allowedTypes={["application/pdf"]}
accept="application/pdf"
onSelect={(media) => setInternalDocument(media)}
name={__("Remplacer le document", "carhop-blocks")}
/>
) : null}
<ToolbarButton onClick={() => resetDocument()}>
{__("Supprimer le document", "carhop-blocks")}
</ToolbarButton>
</BlockControls>
<div className="document-card__preview">
<div className="document-card__content">
<InnerBlocks
allowedBlocks={[
"core/heading",
"core/paragraph",
"core/list",
"core/button",
"core/buttons",
"core/image",
"core/embed",
"core/quote",
"core/pullquote",
"core/media-text",
"core/table",
"core/group",
"core/columns",
"core/post-title",
"carhop-blocks/cta",
"carhop-blocks/heading",
"carhop-blocks/cta-group",
"carhop-blocks/audio-player",
"carhop-blocks/content-box",
"carhop-blocks/notice-panel",
"shortcode",
]}
template={[
[
"carhop-blocks/heading",
{},
[
[
"core/heading",
{
content: "Titre du document",
placeholder: "Saisir le titre",
},
],
[
"core/paragraph",
{
content: "Sous-titre du document",
placeholder: "Saisir le sous-titre",
},
],
],
],
]}
/>
<div className="file_info">
<div className="file_info__type">
{documentType === "internal" ? "PDF" : "Document externe"}
</div>
{documentFileSize > 0 && (
<div className="file_info__size">
( {documentFileSize} Ko )
</div>
)}
</div>
</div>
</div>
</>
)}
</div>
</>
);
}

View File

@ -0,0 +1,31 @@
import { registerBlockType } from "@wordpress/blocks";
import "./style.scss";
import Edit from "./edit";
import save from "./save";
import metadata from "./block.json";
registerBlockType(metadata.name, {
icon: {
src: (
<svg
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
context="list-view"
aria-hidden="true"
focusable="false"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
fill="#146E63"
d="M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
></path>
</svg>
),
},
edit: Edit,
save,
});

View File

@ -0,0 +1,39 @@
import { useBlockProps } from "@wordpress/block-editor";
import { InnerBlocks } from "@wordpress/block-editor";
export default function save({ attributes }) {
const { documentUrl, documentType, documentFileSize } = attributes;
const blockProps = useBlockProps.save({
className: "document-card",
});
if (!documentUrl) {
return (
<div {...blockProps}>
<InnerBlocks.Content />
</div>
);
}
return (
<a
{...blockProps}
href={documentUrl}
target="_blank"
rel="noopener noreferrer"
className={`${blockProps.className || ""} document-card--${documentType}`}
>
<div className="document-card__content">
<InnerBlocks.Content />
<div className="file_info">
<div className="file_info__type">
{documentType === "internal" ? "PDF" : "Document externe"}
</div>
{documentFileSize > 0 && (
<div className="file_info__size">( {documentFileSize} KB )</div>
)}
</div>
</div>
</a>
);
}

View File

@ -1,17 +1,17 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "dynamiques-blocks/explore-tags",
"name": "carhop-blocks/explore-tags",
"version": "0.1.0",
"title": "Explore Tags",
"category": "dynamiques-blocks",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"example": {},
"supports": {
"html": false
},
"textdomain": "explore-tags",
"textdomain": "carhop-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",

View File

@ -8,7 +8,7 @@ export default function Edit(props) {
return (
<div {...useBlockProps({ className: "alignfull" })}>
<ServerSideRender
block="dynamiques-blocks/explore-tags"
block="carhop-blocks/explore-tags"
attributes={props.attributes}
/>
</div>

View File

@ -0,0 +1,99 @@
<?php
if (!function_exists('explore_tags_get_post_types')) {
function explore_tags_get_post_types()
{
$current_blog_id = get_current_blog_id();
if ($current_blog_id === 2) {
return ['articles'];
}
if ($current_blog_id === 1 && is_page()) {
$tax = get_taxonomy('etiquettes');
return $tax->object_type ?? [];
}
// Single ou archive d'un post type
if (is_singular()) {
return [get_post_type()];
}
if (is_post_type_archive()) {
$post_type = get_query_var('post_type');
return is_array($post_type) ? $post_type : [$post_type];
}
return [];
}
}
if (!function_exists('explore_tags_get_post_ids')) {
function explore_tags_get_post_ids($post_types, $limit = 5000)
{
if (empty($post_types)) {
return [];
}
return get_posts([
'post_type' => $post_types,
'post_status' => 'publish',
'fields' => 'ids',
'posts_per_page' => $limit,
'no_found_rows' => true,
]);
}
}
if (!function_exists('explore_tags_get_tags_url')) {
function explore_tags_get_tags_url($tag)
{
$current_blog_id = get_current_blog_id();
if ($current_blog_id === 2) {
return add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles'));
}
if (is_page()) {
$link = get_term_link($tag);
return !is_wp_error($link) ? $link : '#';
}
return add_query_arg('etiquette', $tag->slug, get_post_type_archive_link(get_post_type()));
}
}
$post_types = explore_tags_get_post_types();
$args = [
'taxonomy' => 'etiquettes',
'hide_empty' => false,
];
if (!empty($post_types)) {
$post_ids = explore_tags_get_post_ids($post_types);
if (!empty($post_ids)) {
$args['object_ids'] = $post_ids;
}
}
$tags = get_terms($args);
?>
<section class="explore-tags alignfull">
<div class="inner">
<div class="explore-tags__titling">
<h2 class="explore-tags__title title-small">Tags</h2>
<h3 class="explore-tags__subtitle subtitle-big">Explorer <br /> par Tags</h3>
</div>
<div class="tag-list">
<?php foreach ($tags as $tag) : ?>
<a href="<?php echo esc_url(explore_tags_get_tags_url($tag)); ?>" class="tag-list__tag">
<?php echo $tag->name; ?>
<?php
$svg_path = get_template_directory() . '/resources/img/carhop-fleche-lien-externe-full.svg';
if (file_exists($svg_path)) {
echo file_get_contents($svg_path);
}
?>
</a>
<?php endforeach; ?>
</div>
</div>
</section>

View File

@ -0,0 +1,25 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "carhop-blocks/tab-group",
"version": "0.1.0",
"title": "Tab Group",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Tab Group pour la mise en forme supérieure d'éléments de contenu",
"example": {},
"supports": {
"html": false,
"color": {
"text": true,
"background": false,
"link": false
}
},
"textdomain": "tab-group",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"render": "file:./render.php"
}

View File

@ -0,0 +1,54 @@
import { __ } from "@wordpress/i18n";
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
import { useSelect } from "@wordpress/data";
import "./editor.scss";
export default function Edit({ attributes, setAttributes, clientId }) {
const blockProps = useBlockProps({
className: "tab-group",
});
const tabs = useSelect(
(select) => {
const block = select("core/block-editor").getBlock(clientId);
if (!block?.innerBlocks) return [];
return block.innerBlocks.map((innerBlock, index) => ({
id: `tab-${index + 1}`,
panelId: `tabpanel-${index + 1}`,
title: innerBlock.attributes?.title || __("Sans titre", "tab-group"),
iconUrl: innerBlock.attributes?.iconUrl || "",
}));
},
[clientId],
);
return (
<section {...blockProps}>
<div className="tab-group__toolbar">
<div role="tablist" aria-labelledby="tablist-1" className="tablist">
{tabs.map((tab, index) => (
<button
key={tab.id}
id={tab.id}
type="button"
role="tab"
aria-selected={index === 0}
aria-controls={tab.panelId}
tabIndex={index === 0 ? 0 : -1}
data-tab={index}
>
{tab.iconUrl && (
<img src={tab.iconUrl} alt="" className="tab__icon" aria-hidden />
)}
<span>{tab.title}</span>
</button>
))}
</div>
</div>
<InnerBlocks
allowedBlocks={["carhop-blocks/tab"]}
template={[["carhop-blocks/tab"]]}
/>
</section>
);
}

View File

@ -0,0 +1,9 @@
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-chapo {
border: 1px dotted #f00;
}

View File

@ -0,0 +1,26 @@
import { registerBlockType } from "@wordpress/blocks";
import "./style.scss";
import Edit from "./edit";
import save from "./save";
import metadata from "./block.json";
registerBlockType(metadata.name, {
icon: {
src: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="64"
height="64"
viewBox="0 0 64 64"
>
<path
d="M46,10H8c-2.1,0-4.2.8-5.7,2.3s-2.3,3.5-2.3,5.7v38c0,2.1.8,4.2,2.3,5.7s3.5,2.3,5.7,2.3h38c2.1,0,4.2-.8,5.7-2.3s2.3-3.5,2.3-5.7V18c0-2.1-.8-4.2-2.3-5.7s-3.5-2.3-5.7-2.3ZM25.8,18.3c.5-.5,1.3-.8,2-.8h0c1.1,0,2.2.7,2.6,1.8.4,1.1.2,2.3-.6,3.1s-2,1.1-3.1.6c-1.1-.4-1.7-1.5-1.8-2.6,0-.8.3-1.5.8-2ZM19.5,17.5c1.1,0,2.2.7,2.6,1.8.4,1.1.2,2.3-.6,3.1s-2,1.1-3.1.6c-1.1-.4-1.7-1.5-1.8-2.6,0-1.6,1.3-2.8,2.8-2.8ZM11.2,17.5c1.6,0,2.8,1.3,2.8,2.8s-1.3,2.8-2.8,2.8-2.8-1.3-2.8-2.8,1.3-2.8,2.8-2.8ZM50,56c0,2.2-1.8,4-4,4H8c-2.2,0-4-1.8-4-4v-25.3h46v25.3ZM61.7,2.3C60.2.8,58.1,0,56,0H18C15.9,0,13.8.8,12.3,2.3s-2.3,3.5-2.3,5.7h36c5.5,0,10,4.5,10,10v36c2.1,0,4.2-.8,5.7-2.3s2.3-3.5,2.3-5.7V8c0-2.1-.8-4.2-2.3-5.7Z"
fill="#146E63"
/>
</svg>
),
},
edit: Edit,
save,
});

View File

@ -0,0 +1,48 @@
<?php
$wrapper_attributes = get_block_wrapper_attributes(['class' => 'tab-group']);
$inner_blocks = $block->parsed_block['innerBlocks'] ?? [];
// Extraire les titres et icônes des blocs tab pour les boutons
$tabs = array_map(function ($inner_block) {
return [
'title' => $inner_block['attrs']['title'] ?? __('Sans titre', 'tab-group'),
'iconUrl' => $inner_block['attrs']['iconUrl'] ?? '',
];
}, array_filter($inner_blocks, fn($b) => ($b['blockName'] ?? '') === 'carhop-blocks/tab'));
?>
<section <?php echo $wrapper_attributes; ?>>
<div class="tab-group__toolbar">
<div role="tablist" aria-label="<?php esc_attr_e('Onglets', 'tab-group'); ?>" class="tablist">
<?php foreach ($tabs as $index => $tab) : ?>
<button
type="button"
role="tab"
aria-selected="<?php echo $index === 0 ? 'true' : 'false'; ?>"
aria-controls="tabpanel-<?php echo esc_attr($index + 1); ?>"
tabindex="<?php echo $index === 0 ? '0' : '-1'; ?>"
data-tab="<?php echo esc_attr($index); ?>">
<?php if (!empty($tab['iconUrl'])) : ?>
<img src="<?php echo esc_url($tab['iconUrl']); ?>" alt="" class="tab__icon" aria-hidden />
<?php endif; ?>
<span><?php echo esc_html($tab['title']); ?></span>
</button>
<?php endforeach; ?>
</div>
</div>
<div class="tab-group__innerblocks">
<?php foreach ($inner_blocks as $index => $inner_block) : ?>
<div class="wp-block-carhop-blocks-tab tab" id="tabpanel-<?php echo esc_attr($index + 1); ?>" role="tabpanel" data-active="<?php echo $index === 0 ? 'true' : 'false'; ?>">
<?php echo render_block($inner_block); ?>
</div>
<?php endforeach; ?>
</div>
</section>

View File

@ -0,0 +1,6 @@
import { useBlockProps } from "@wordpress/block-editor";
import { InnerBlocks } from "@wordpress/block-editor";
export default function save() {
return <InnerBlocks.Content />;
}

View File

@ -0,0 +1,36 @@
.tab__title {
margin-bottom: 2rem;
}
.tablist {
button {
gap: 10px !important;
}
button[aria-selected="false"] {
img {
filter: grayscale(100%);
}
}
}
.tab-group__toolbar {
margin-bottom: 2rem;
}
.tablist .tab__icon {
--iconSize: 1.5rem;
width: var(--iconSize);
height: var(--iconSize);
// background: blue;
object-fit: contain;
object-position: center;
vertical-align: middle;
}
.wp-block-carhop-blocks-tab[data-active="false"] {
display: none;
}
.wp-block-carhop-blocks-tab[data-active="true"] {
display: block !important;
}

View File

@ -0,0 +1,34 @@
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".tab-group").forEach((TabGroup) => {
const toolbar = TabGroup.querySelector(".tab-group__toolbar");
const tabs = toolbar.querySelectorAll("button");
function setActiveTab(currentTab) {
tabs.forEach((tab) => {
tab.setAttribute("aria-selected", "false");
});
currentTab.setAttribute("aria-selected", "true");
}
function setActiveTabPanel(currentTabButton) {
const currentTabPanelId = currentTabButton.getAttribute("aria-controls");
const currentTabPanel = TabGroup.querySelector(`#${currentTabPanelId}`);
console.log(currentTabPanel);
hideAllTabPanels();
currentTabPanel.setAttribute("data-active", "true");
}
function hideAllTabPanels() {
const tabPanels = TabGroup.querySelectorAll(
".tab-group__innerblocks .tab",
);
tabPanels.forEach((tabPanel) => {
tabPanel.setAttribute("data-active", "false");
});
}
tabs.forEach((tab) => {
tab.addEventListener("click", () => {
setActiveTab(tab);
setActiveTabPanel(tab);
});
});
});
});

View File

@ -0,0 +1,30 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "carhop-blocks/tab",
"version": "0.1.0",
"title": "Tab",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Tab pour la mise en forme supérieure d'éléments de contenu",
"example": {},
"supports": {
"html": false,
"color": {
"text": true,
"background": false,
"link": false
}
},
"textdomain": "tab",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"title": {
"type": "string",
"default": ""
}
}
}

View File

@ -0,0 +1,109 @@
import { __ } from "@wordpress/i18n";
import {
useBlockProps,
RichText,
InnerBlocks,
InspectorControls,
MediaUpload,
MediaUploadCheck,
} from "@wordpress/block-editor";
import "./editor.scss";
import { PanelBody, TextControl, Button } from "@wordpress/components";
export default function Edit({ attributes, setAttributes }) {
const { title, iconId, iconUrl } = attributes;
const blockProps = useBlockProps({
className: "block-chapo",
});
return (
<>
<InspectorControls>
<PanelBody title={__("Tab", "carhop-blocks")}>
<TextControl
label={__("Titre", "carhop-blocks")}
value={title}
onChange={(value) => setAttributes({ title: value })}
/>
</PanelBody>
<PanelBody title={__("Icône", "carhop-blocks")}>
<MediaUploadCheck>
<MediaUpload
onSelect={(media) =>
setAttributes({
iconId: media.id,
iconUrl: media.url,
})
}
allowedTypes={["image"]}
value={iconId}
render={({ open }) => (
<>
{iconUrl ? (
<div className="tab__icon-preview">
<img src={iconUrl} alt="" style={{ maxWidth: 48, height: "auto" }} />
<div style={{ marginTop: 8 }}>
<Button variant="secondary" onClick={open} style={{ marginRight: 8 }}>
{__("Remplacer", "carhop-blocks")}
</Button>
<Button
variant="tertiary"
isDestructive
onClick={() =>
setAttributes({ iconId: 0, iconUrl: "" })
}
>
{__("Supprimer", "carhop-blocks")}
</Button>
</div>
</div>
) : (
<Button variant="secondary" onClick={open}>
{__("Choisir une image", "carhop-blocks")}
</Button>
)}
</>
)}
/>
</MediaUploadCheck>
</PanelBody>
</InspectorControls>
<div {...blockProps}>
<RichText
tagName="h2"
className="tab__title"
placeholder="Titre"
value={title}
onChange={(value) => setAttributes({ title: value })}
/>
<InnerBlocks
allowedBlocks={[
"core/heading",
"core/paragraph",
"core/list",
"core/button",
"core/buttons",
"core/image",
"core/embed",
"core/quote",
"core/pullquote",
"core/media-text",
"core/table",
"core/group",
"core/columns",
"core/post-title",
"carhop-blocks/cta",
"carhop-blocks/heading",
"carhop-blocks/cta-group",
"carhop-blocks/audio-player",
"carhop-blocks/content-box",
"carhop-blocks/notice-panel",
"shortcode",
]}
template={[["core/paragraph", { content: "Contenu" }]]}
/>
</div>
</>
);
}

View File

@ -0,0 +1,9 @@
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-chapo {
border: 1px dotted #f00;
}

View File

@ -0,0 +1,26 @@
import { registerBlockType } from "@wordpress/blocks";
import "./style.scss";
import Edit from "./edit";
import save from "./save";
import metadata from "./block.json";
registerBlockType(metadata.name, {
icon: {
src: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="83.3"
height="83.3"
viewBox="0 0 83.3 83.3"
>
<path
fill="#146E63"
d="M72.7,0H10.7C4.8,0,0,4.8,0,10.7v62c0,5.9,4.8,10.7,10.7,10.7h62c5.9,0,10.7-4.8,10.7-10.7V10.7c0-5.9-4.8-10.7-10.7-10.7ZM10.7,5.8h62c2.7,0,4.8,2.2,4.8,4.8v8.7H5.8v-8.7c0-2.7,2.2-4.8,4.8-4.8ZM72.7,77.5H10.7c-2.7,0-4.8-2.2-4.8-4.8V25.2h71.7v47.5c0,1.3-.5,2.5-1.4,3.4s-2.1,1.4-3.4,1.4h0ZM9.7,12.5c0-1.5,1.3-2.7,2.8-2.8h19.5c.8-.1,1.7.2,2.3.7.6.6,1,1.3,1,2.2s-.4,1.6-1,2.2c-.6.6-1.5.8-2.3.7H12.5c-.8,0-1.5-.4-2-.9-.5-.6-.8-1.3-.8-2.1h0Z"
/>
</svg>
),
},
edit: Edit,
save,
});

View File

@ -0,0 +1,17 @@
import { useBlockProps } from "@wordpress/block-editor";
import { InnerBlocks } from "@wordpress/block-editor";
import { RichText } from "@wordpress/block-editor";
export default function save({ attributes }) {
const { title } = attributes;
const blockProps = useBlockProps.save({
className: "tab",
});
return (
<>
<RichText.Content value={title} tagName="h2" className="tab__title" />
<InnerBlocks.Content />
</>
);
}

View File

@ -0,0 +1,12 @@
/**
* 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-chapo {
background-color: #21759b;
color: #fff;
padding: 2px;
}

View File

@ -0,0 +1,25 @@
/**
* Use this file for JavaScript code that you want to run in the front-end
* on posts/pages that contain this block.
*
* When this file is defined as the value of the `viewScript` property
* in `block.json` it will be enqueued on the front end of the site.
*
* Example:
*
* ```js
* {
* "viewScript": "file:./view.js"
* }
* ```
*
* If you're not making any changes to this file because your project doesn't need any
* JavaScript running in the front-end, then you should delete this file and remove
* the `viewScript` property from `block.json`.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script
*/
/* eslint-disable no-console */
console.log( 'Hello World! (from create-block-chapo block)' );
/* eslint-enable no-console */

View File

@ -37,28 +37,6 @@ return array(
)
)
),
'explore-tags' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
'name' => 'dynamiques-blocks/explore-tags',
'version' => '0.1.0',
'title' => 'Explore Tags',
'category' => 'dynamiques-blocks',
'icon' => 'smiley',
'description' => 'Example block scaffolded with Create Block tool.',
'example' => array(
),
'supports' => array(
'html' => false
),
'textdomain' => 'explore-tags',
'editorScript' => 'file:./index.js',
'editorStyle' => 'file:./index.css',
'style' => 'file:./style-index.css',
'viewScript' => 'file:./view.js',
'render' => 'file:./render.php'
),
'interview' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,

View File

@ -1 +0,0 @@
{"version":3,"file":"explore-tags/index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://dynamiques-blocks/./src/explore-tags/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-explore-tags {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

File diff suppressed because one or more lines are too long

View File

@ -1,30 +0,0 @@
<?php
$tags = get_terms(array(
'taxonomy' => 'etiquettes',
'hide_empty' => false,
));
?>
<section class="explore-tags alignfull">
<div class="inner">
<div class="explore-tags__titling">
<h2 class="explore-tags__title title-small">Tags</h2>
<h3 class="explore-tags__subtitle subtitle-big">Explorer <br /> par Tags</h2>
</div>
<div class="tag-list">
<?php foreach ($tags as $tag) : ?>
<a href="<?php echo add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles')); ?>" class="tag-list__tag">
<?php echo $tag->name; ?>
<?php
$svg_path = get_template_directory() . '/resources/img/carhop-fleche-lien-externe-full.svg';
if (file_exists($svg_path)) {
echo file_get_contents($svg_path);
}
?>
</a>
<?php endforeach; ?>
</div>
</div>
</section>

View File

@ -1 +0,0 @@
{"version":3,"file":"explore-tags/style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://dynamiques-blocks/./src/explore-tags/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-explore-tags {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""}

View File

@ -1,30 +0,0 @@
<?php
$tags = get_terms(array(
'taxonomy' => 'etiquettes',
'hide_empty' => false,
));
?>
<section class="explore-tags alignfull">
<div class="inner">
<div class="explore-tags__titling">
<h2 class="explore-tags__title title-small">Tags</h2>
<h3 class="explore-tags__subtitle subtitle-big">Explorer <br /> par Tags</h2>
</div>
<div class="tag-list">
<?php foreach ($tags as $tag) : ?>
<a href="<?php echo add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles')); ?>" class="tag-list__tag">
<?php echo $tag->name; ?>
<?php
$svg_path = get_template_directory() . '/resources/img/carhop-fleche-lien-externe-full.svg';
if (file_exists($svg_path)) {
echo file_get_contents($svg_path);
}
?>
</a>
<?php endforeach; ?>
</div>
</div>
</section>