Connected announcement bar to Settings API data

refs https://github.com/TryGhost/Team/issues/3009

- The change hooks up the announcement bar script to use "announcement" and "announcement_background" values coming from the Content Settings API
This commit is contained in:
Naz 2023-04-19 17:39:25 +02:00 committed by Elena Baidakova
parent 8e7a150237
commit 7270c17a1d

View File

@ -5,16 +5,15 @@ import {ReactComponent as CloseIcon} from '../icons/clear.svg';
export function AnnouncementBar({settings}) {
const [visible, setVisible] = React.useState(true);
// eslint-disable-next-line no-unused-vars
const [data, setData] = React.useState({content: '<p>Content with <a href="https://ghost.org/">link</a></p>'});
if (!visible) {
return null;
}
let className = 'gh-announcement-bar ' + settings?.announcement_background;
return (
<div className="gh-announcement-bar dark">
<div className="gh-announcement-bar-content" dangerouslySetInnerHTML={{__html: data.content}}></div>
<div className={className}>
<div className="gh-announcement-bar-content" dangerouslySetInnerHTML={{__html: settings?.announcement}}></div>
<button onClick={() => setVisible(false)}>
<CloseIcon />
</button>