diff --git a/plugins/carhop-blocks/src/content-box/block.json b/plugins/carhop-blocks/src/content-box/block.json
index a2d2b5c..c316772 100644
--- a/plugins/carhop-blocks/src/content-box/block.json
+++ b/plugins/carhop-blocks/src/content-box/block.json
@@ -38,10 +38,24 @@
"type": "string",
"default": "inherit"
},
+ "borderColor": {
+ "type": "string",
+ "default": null
+ },
"blockVariant": {
"type": "string",
"default": "framed"
},
+ "shapeType": {
+ "type": "string",
+ "default": "straight",
+ "enum": [
+ "straight",
+ "shapeA",
+ "shapeB",
+ "shapeC"
+ ]
+ },
"blockWidth": {
"type": "string",
"default": "full",
diff --git a/plugins/carhop-blocks/src/content-box/edit.js b/plugins/carhop-blocks/src/content-box/edit.js
index fe658f1..ead398c 100644
--- a/plugins/carhop-blocks/src/content-box/edit.js
+++ b/plugins/carhop-blocks/src/content-box/edit.js
@@ -24,8 +24,12 @@ import {
Button,
CheckboxControl,
ColorPalette,
+ SelectControl,
} from "@wordpress/components";
+import ShapeA from "./shapeA.jsx";
+import ShapeB from "./shapeB.jsx";
+import ShapeC from "./shapeC.jsx";
import { filterBgColors, filterTextColors } from "./utilities";
export default function Edit({ attributes, setAttributes, ...props }) {
@@ -38,6 +42,8 @@ export default function Edit({ attributes, setAttributes, ...props }) {
hasLightBackground,
blockVariant,
blockWidth,
+ shapeType,
+ borderColor,
} = attributes;
// Détecter le type de post actuel
@@ -84,6 +90,9 @@ export default function Edit({ attributes, setAttributes, ...props }) {
setAttributes({ hasLightBackground: true });
}
}
+
+ console.log(shapeType);
+ console.log(blockVariant);
return (
<>
@@ -119,48 +128,85 @@ export default function Edit({ attributes, setAttributes, ...props }) {
-
- {blockVariant === "backgrounded" ||
- (blockVariant === "framed-backgrounded" && (
-
-
- Couleur de fond
-
-
- <>
-
- >
-
-
- ))}
-
- {(blockVariant === "backgrounded" ||
- blockVariant === "framed-backgrounded") &&
- postType !== "articles" && (
-
-
- Couleur du texte
-
-
-
-
-
- )}
+
+ {(blockVariant === "backgrounded" ||
+ blockVariant === "framed-backgrounded") && (
+
+ setAttributes({ shapeType: value })}
+ value={shapeType}
+ >
+
+
+
+
+
+
+ setAttributes({ shapeType: value })}
+ value={shapeType}
+ options={[
+ {
+ disabled: true,
+ label: "Type de forme",
+ value: "",
+ },
+ {
+ label: "Droite",
+ value: "straight",
+ },
+ {
+ label: "Forme A",
+ value: "shapeA",
+ },
+ {
+ label: "Forme B",
+ value: "shapeB",
+ },
+ {
+ label: "Forme C",
+ value: "shapeC",
+ },
+ ]}
+ />
+
+
+
+ )}
+
+ {(blockVariant === "backgrounded" ||
+ blockVariant === "framed-backgrounded") &&
+ postType !== "articles" && (
+
+
+
+ )}
+ {blockVariant === "backgrounded" &&
+ backgroundColor &&
+ shapeType === "shapeA" && (
+
+ )}
+ {blockVariant === "backgrounded" &&
+ backgroundColor &&
+ shapeType === "shapeB" && (
+
+ )}
+ {blockVariant === "backgrounded" &&
+ backgroundColor &&
+ shapeType === "shapeC" && (
+
+ )}
+ {blockVariant === "framed" &&
+ backgroundColor &&
+ shapeType === "shapeA" && (
+
+ )}
+ {blockVariant === "framed" &&
+ backgroundColor &&
+ shapeType === "shapeB" && (
+
+ )}
+ {blockVariant === "framed" &&
+ backgroundColor &&
+ shapeType === "shapeC" && (
+
+ )}
+ {blockVariant === "backgrounded" &&
+ backgroundColor &&
+ shapeType === "shapeA" && (
+
+ )}
+ {blockVariant === "backgrounded" &&
+ backgroundColor &&
+ shapeType === "shapeB" && (
+
+ )}
+ {blockVariant === "backgrounded" &&
+ backgroundColor &&
+ shapeType === "shapeC" && (
+
+ )}
+ {blockVariant === "framed" &&
+ backgroundColor &&
+ shapeType === "shapeA" && (
+
+ )}
+ {blockVariant === "framed" &&
+ backgroundColor &&
+ shapeType === "shapeB" && (
+
+ )}
+ {blockVariant === "framed" &&
+ backgroundColor &&
+ shapeType === "shapeC" && (
+
+ )}
diff --git a/plugins/carhop-blocks/src/content-box/shapeA.jsx b/plugins/carhop-blocks/src/content-box/shapeA.jsx
new file mode 100644
index 0000000..f92f323
--- /dev/null
+++ b/plugins/carhop-blocks/src/content-box/shapeA.jsx
@@ -0,0 +1,32 @@
+import React from "react";
+
+export default function ShapeA({
+ backgroundOrientation,
+ backgroundColor,
+ borderColor,
+}) {
+ return (
+
+ );
+}
diff --git a/plugins/carhop-blocks/src/content-box/shapeB.jsx b/plugins/carhop-blocks/src/content-box/shapeB.jsx
new file mode 100644
index 0000000..560d1d6
--- /dev/null
+++ b/plugins/carhop-blocks/src/content-box/shapeB.jsx
@@ -0,0 +1,30 @@
+import React from "react";
+
+export default function ShapeB({
+ backgroundOrientation,
+ backgroundColor,
+ borderColor,
+}) {
+ return (
+
+ );
+}
diff --git a/plugins/carhop-blocks/src/content-box/shapeC.jsx b/plugins/carhop-blocks/src/content-box/shapeC.jsx
new file mode 100644
index 0000000..8725dc9
--- /dev/null
+++ b/plugins/carhop-blocks/src/content-box/shapeC.jsx
@@ -0,0 +1,32 @@
+import React from "react";
+
+export default function ShapeB({
+ backgroundOrientation,
+ backgroundColor,
+ borderColor,
+}) {
+ return (
+ <>
+
+ >
+ );
+}