0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

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}) { export function AnnouncementBar({settings}) {
const [visible, setVisible] = React.useState(true); 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) { if (!visible) {
return null; return null;
} }
let className = 'gh-announcement-bar ' + settings?.announcement_background;
return ( return (
<div className="gh-announcement-bar dark"> <div className={className}>
<div className="gh-announcement-bar-content" dangerouslySetInnerHTML={{__html: data.content}}></div> <div className="gh-announcement-bar-content" dangerouslySetInnerHTML={{__html: settings?.announcement}}></div>
<button onClick={() => setVisible(false)}> <button onClick={() => setVisible(false)}>
<CloseIcon /> <CloseIcon />
</button> </button>