From 7bb9b66b5f30ba96a2f4c5ef161392ece12aa5e8 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Tue, 5 May 2026 14:56:56 +0200 Subject: [PATCH] FEATURE Handling content-card border --- .../carhop-blocks/src/content-card/block.json | 4 ++++ .../carhop-blocks/src/content-card/edit.js | 24 +++++++++++++++---- .../carhop-blocks/src/content-card/save.js | 11 ++++++--- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/plugins/carhop-blocks/src/content-card/block.json b/plugins/carhop-blocks/src/content-card/block.json index 0626a1e..df21549 100644 --- a/plugins/carhop-blocks/src/content-card/block.json +++ b/plugins/carhop-blocks/src/content-card/block.json @@ -17,6 +17,10 @@ "style": "file:./style-index.css", "viewScript": "file:./view.js", "attributes": { + "hasBorder": { + "type": "boolean", + "default": true + }, "hasBackgroundColor": { "type": "boolean", "default": false diff --git a/plugins/carhop-blocks/src/content-card/edit.js b/plugins/carhop-blocks/src/content-card/edit.js index 171ce0f..b0ecc33 100644 --- a/plugins/carhop-blocks/src/content-card/edit.js +++ b/plugins/carhop-blocks/src/content-card/edit.js @@ -21,8 +21,13 @@ import { export default function Edit({ attributes, setAttributes, ...props }) { const colors = useSetting("color.palette.theme"); - const { hasBackgroundColor, backgroundColor, textColor, hasLightBackground } = - attributes; + const { + hasBackgroundColor, + backgroundColor, + textColor, + hasLightBackground, + hasBorder, + } = attributes; function onBackgroundColorChange(value) { if (value === undefined) { @@ -47,6 +52,16 @@ export default function Edit({ attributes, setAttributes, ...props }) { <> + setAttributes({ hasBorder: value })} + /> + + {/* @@ -78,7 +93,7 @@ export default function Edit({ attributes, setAttributes, ...props }) { /> )} - + */}
diff --git a/plugins/carhop-blocks/src/content-card/save.js b/plugins/carhop-blocks/src/content-card/save.js index cd86837..bdf73d8 100644 --- a/plugins/carhop-blocks/src/content-card/save.js +++ b/plugins/carhop-blocks/src/content-card/save.js @@ -2,8 +2,13 @@ import { useBlockProps, InnerBlocks } from "@wordpress/block-editor"; import { isColorLight } from "../../_utilities/utilities"; export default function save({ attributes }) { - const { backgroundColor, textColor, hasLightBackground, hasBackgroundColor } = - attributes; + const { + backgroundColor, + textColor, + hasLightBackground, + hasBackgroundColor, + hasBorder, + } = attributes; return (