FEATURE Introducing the component
This commit is contained in:
parent
5e6f557ff0
commit
e4a0b345d6
18
plugins/dynamiques-blocks/blocks/a-propos/.editorconfig
Normal file
18
plugins/dynamiques-blocks/blocks/a-propos/.editorconfig
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
# WordPress Coding Standards
|
||||
# https://make.wordpress.org/core/handbook/coding-standards/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
21
plugins/dynamiques-blocks/blocks/a-propos/package.json
Normal file
21
plugins/dynamiques-blocks/blocks/a-propos/package.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "front-header",
|
||||
"version": "0.1.0",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"author": "The WordPress Contributors",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"main": "build/index.js",
|
||||
"scripts": {
|
||||
"build": "wp-scripts build",
|
||||
"format": "wp-scripts format",
|
||||
"lint:css": "wp-scripts lint-style",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"packages-update": "wp-scripts packages-update",
|
||||
"plugin-zip": "wp-scripts plugin-zip",
|
||||
"start": "wp-scripts start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^30.12.0"
|
||||
},
|
||||
"packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
|
||||
}
|
||||
12865
plugins/dynamiques-blocks/blocks/a-propos/pnpm-lock.yaml
Normal file
12865
plugins/dynamiques-blocks/blocks/a-propos/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
plugins/dynamiques-blocks/blocks/a-propos/src/.DS_Store
vendored
Normal file
BIN
plugins/dynamiques-blocks/blocks/a-propos/src/.DS_Store
vendored
Normal file
Binary file not shown.
20
plugins/dynamiques-blocks/blocks/a-propos/src/block.json
Normal file
20
plugins/dynamiques-blocks/blocks/a-propos/src/block.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "dynamiques-blocks/a-propos",
|
||||
"version": "0.1.0",
|
||||
"title": "Header",
|
||||
"category": "carhop-blocks",
|
||||
"icon": "smiley",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"example": {},
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "front-header",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"viewScript": "file:./view.js"
|
||||
|
||||
}
|
||||
27
plugins/dynamiques-blocks/blocks/a-propos/src/edit.js
Normal file
27
plugins/dynamiques-blocks/blocks/a-propos/src/edit.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
|
||||
import "./editor.scss";
|
||||
|
||||
export default function Edit() {
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps({
|
||||
className: "block-front-header",
|
||||
})}
|
||||
>
|
||||
<div className="front-header__innerblocks">
|
||||
<InnerBlocks
|
||||
template={[
|
||||
["core/paragraph", { placeholder: "Ajouter ici le texte" }],
|
||||
]}
|
||||
allowedBlocks={[
|
||||
"core/paragraph",
|
||||
"core/list",
|
||||
"core/button",
|
||||
"core/buttons",
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.wp-block-front-header-front-header {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
25
plugins/dynamiques-blocks/blocks/a-propos/src/index.js
Normal file
25
plugins/dynamiques-blocks/blocks/a-propos/src/index.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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: {
|
||||
foreground: "#723d46",
|
||||
src: (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 401.94 401.92">
|
||||
<defs></defs>
|
||||
<g id="Calque_1-2" data-name="Calque 1">
|
||||
<path
|
||||
class="cls-1"
|
||||
d="m378.98,212.46h22.87v-23.16h-22.87v23.16Zm22.88-70.39h-22.8v23.02h22.8v-23.02ZM23.05,284.21H0v22.98h23.05v-22.98Zm0-47.48H.15v22.93h22.9v-22.93ZM.24,354.72h22.81v-23.23H.24v23.23Zm378.76-.18h22.87v-23.18h-22.87v23.18ZM154.05,70.49h188.68v-23.24h-188.68v23.24Zm-94.63.01h46.52v-23.11h-46.52v23.11Zm342.51,213.59h-22.82v23.14h22.82v-23.14Zm.01-284.09H.21v117.71h401.72V0Zm-23.3,92.03c0,.48-.2.95-.45,2.04H23.8c-.16-1.47-.4-2.75-.41-4.02-.02-20.67.06-41.33-.09-62-.03-3.65.91-4.87,4.73-4.87,115.33.09,230.65.08,345.98.05,2.73,0,4.77-.03,4.74,3.8-.15,21.66-.09,43.33-.12,65Zm-236.39,309.65h22.86v-22.83h-22.86v22.83Zm141.95.17h23.06v-22.89h-23.06v22.89Zm-47.24,0h22.85v-22.82h-22.85v22.82Zm94.54.02h23.11v-22.87h-23.11v22.87Zm47.48-22.9v22.78h22.96v-22.78h-22.96Zm22.79-142.11h-22.81v22.91h22.81v-22.91ZM.14,401.73h22.91v-22.88H.14v22.88Zm.07-189.19h22.87v-23.16H.21v23.16Zm-.07-47.59h23.05v-22.76H.15v22.76Zm94.7,236.76h22.98v-22.86h-22.98v22.86Zm94.53,0h23.24v-22.8h-23.24v22.8Zm-141.94.21h23.12v-23.03h-23.12v23.03Z"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save,
|
||||
});
|
||||
15
plugins/dynamiques-blocks/blocks/a-propos/src/save.js
Normal file
15
plugins/dynamiques-blocks/blocks/a-propos/src/save.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
|
||||
|
||||
export default function save() {
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps.save({
|
||||
className: "block-front-header",
|
||||
})}
|
||||
>
|
||||
<div className="front-header__innerblocks">
|
||||
<InnerBlocks.Content />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
5
plugins/dynamiques-blocks/blocks/a-propos/src/style.scss
Normal file
5
plugins/dynamiques-blocks/blocks/a-propos/src/style.scss
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// .wp-block-front-header-front-header {
|
||||
// background-color: #21759b;
|
||||
// color: #fff;
|
||||
// padding: 2px;
|
||||
// }
|
||||
1
plugins/dynamiques-blocks/blocks/a-propos/src/view.js
Normal file
1
plugins/dynamiques-blocks/blocks/a-propos/src/view.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
console.log("Hello World! (from front-header-front-header block)");
|
||||
Loading…
Reference in New Issue
Block a user