From 7cf6626131276a79b765fc6f9a102522d7d9ed56 Mon Sep 17 00:00:00 2001 From: Giulia Ghisini <51911425+giuliaghisini@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:23:48 +0100 Subject: [PATCH] fix: backwards compatibility for background color var of Alert block (#459) --- src/components/ItaliaTheme/Blocks/Alert/Edit.jsx | 2 +- src/components/ItaliaTheme/Blocks/Alert/View.jsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx b/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx index f8c7d261b..d9294e994 100644 --- a/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx @@ -60,7 +60,7 @@ class Edit extends Component { constructor(props) { super(props); if (!this.props.data.bg_color) { - this.props.data.bg_color = 'warning'; + this.props.data.bg_color = this.props.data.color ?? 'warning'; // backwards compatibility with previous background-color variable name 'color' } this.blockNode = React.createRef(); } diff --git a/src/components/ItaliaTheme/Blocks/Alert/View.jsx b/src/components/ItaliaTheme/Blocks/Alert/View.jsx index c4e4f66f7..7b54338f5 100644 --- a/src/components/ItaliaTheme/Blocks/Alert/View.jsx +++ b/src/components/ItaliaTheme/Blocks/Alert/View.jsx @@ -27,9 +27,11 @@ const View = ({ data, pathname }) => { ) : ''; + const background_color = data.bg_color ?? data.color; // backwards compatibility with previous background-color variable name 'color' + return (
-
+
{data.image?.data && (