Skip to content

Commit

Permalink
fix: backwards compatibility for background color var of Alert block (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini authored Jan 5, 2024
1 parent d836021 commit 7cf6626
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/ItaliaTheme/Blocks/Alert/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/ItaliaTheme/Blocks/Alert/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<section role="alert" className="block alertblock">
<div className={cx('full-width', 'bg-alert-' + data.bg_color)}>
<div className={cx('full-width', 'bg-alert-' + background_color)}>
<Container className="p-4 pt-5 pb-5">
<Row className="align-items-start">
{data.image?.data && (
Expand Down

0 comments on commit 7cf6626

Please sign in to comment.