From 31158d734a36a90c02084a6148677501e930b871 Mon Sep 17 00:00:00 2001 From: Steve Ross Date: Tue, 3 Feb 2026 13:00:27 +0000 Subject: [PATCH] block settings: toggle for text contrast and fix colour/tint --- .../js/blocks/components/BlockSettings.jsx | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/web/app/themes/badegg/resources/js/blocks/components/BlockSettings.jsx b/web/app/themes/badegg/resources/js/blocks/components/BlockSettings.jsx index fa7b3d9e..919f6bdf 100644 --- a/web/app/themes/badegg/resources/js/blocks/components/BlockSettings.jsx +++ b/web/app/themes/badegg/resources/js/blocks/components/BlockSettings.jsx @@ -150,33 +150,38 @@ export default function BlockSettings({ attributes, setAttributes }) { slug = selected.slug; } - setAttributes( { + let colourAttributes = { background_colour: slug, background_hex: hex, - }); + }; + + if(!slug || [0, '0', 'white', 'black'].includes(slug)) { + colourAttributes.background_tint = '0'; + } + + setAttributes( colourAttributes ); } } /> { 'background_colour' in attributes && attributes.background_colour && ![0, '0', 'white', 'black'].includes(attributes.background_colour) ? ( - <> - setAttributes({ background_tint: value }) } - __next40pxDefaultSize={ true } - __nextHasNoMarginBottom={ true } - /> - setAttributes({ background_contrast: value }) } - __nextHasNoMarginBottom - /> - + setAttributes({ background_tint: value }) } + __next40pxDefaultSize={ true } + __nextHasNoMarginBottom={ true } + /> ) : null } + setAttributes({ background_contrast: value }) } + __nextHasNoMarginBottom + /> + { background_image != 0 && ( <>