background tint no longer requires background image

This commit is contained in:
2026-01-04 17:59:01 +00:00
parent 703f883000
commit 1b05d22cd8

View File

@@ -85,6 +85,7 @@ export default function BlockSettings({ attributes, setAttributes }) {
background_hex, background_hex,
background_tint, background_tint,
background_image, background_image,
background_url,
background_opacity, background_opacity,
background_contrast, background_contrast,
background_fixed, background_fixed,
@@ -156,24 +157,26 @@ export default function BlockSettings({ attributes, setAttributes }) {
/> />
{ 'background_colour' in attributes && attributes.background_colour && ![0, '0', 'white', 'black'].includes(attributes.background_colour) ? ( { 'background_colour' in attributes && attributes.background_colour && ![0, '0', 'white', 'black'].includes(attributes.background_colour) ? (
<SelectControl
label={ __("Background Tint", "badegg") }
value={ background_tint }
options={ configOptions.tints }
onChange={ (value) => setAttributes({ background_tint: value }) }
__next40pxDefaultSize={ true }
__nextHasNoMarginBottom={ true }
/>
) : null }
{ background_image != 0 && (
<> <>
<SelectControl
label={ __("Background Tint", "badegg") }
value={ background_tint }
options={ configOptions.tints }
onChange={ (value) => setAttributes({ background_tint: value }) }
__next40pxDefaultSize={ true }
__nextHasNoMarginBottom={ true }
/>
<ToggleControl <ToggleControl
label={ __('Text Contrast', 'badegg') } label={ __('Text Contrast', 'badegg') }
checked={ background_contrast } checked={ background_contrast }
onChange={(value) => setAttributes({ background_contrast: value }) } onChange={(value) => setAttributes({ background_contrast: value }) }
__nextHasNoMarginBottom __nextHasNoMarginBottom
/> />
</>
) : null }
{ background_image != 0 && (
<>
<ToggleControl <ToggleControl
label={ __('Fixed Position', 'badegg') } label={ __('Fixed Position', 'badegg') }
checked={ background_fixed } checked={ background_fixed }
@@ -216,7 +219,7 @@ export default function BlockSettings({ attributes, setAttributes }) {
{ background_image != 0 && ( { background_image != 0 && (
<Button <Button
onClick={ () => setAttributes({ background_image: 0 }) } onClick={ () => setAttributes({ background_image: 0, background_url: '' }) }
isDestructive isDestructive
variant="secondary" variant="secondary"
> >