mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Add closing logic
This commit is contained in:
parent
6e1cb2f8ad
commit
8e7a150237
1 changed files with 6 additions and 1 deletions
|
@ -4,13 +4,18 @@ import './AnnouncementBar.css';
|
||||||
import {ReactComponent as CloseIcon} from '../icons/clear.svg';
|
import {ReactComponent as CloseIcon} from '../icons/clear.svg';
|
||||||
|
|
||||||
export function AnnouncementBar({settings}) {
|
export function AnnouncementBar({settings}) {
|
||||||
|
const [visible, setVisible] = React.useState(true);
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const [data, setData] = React.useState({content: '<p>Content with <a href="https://ghost.org/">link</a></p>'});
|
const [data, setData] = React.useState({content: '<p>Content with <a href="https://ghost.org/">link</a></p>'});
|
||||||
|
|
||||||
|
if (!visible) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="gh-announcement-bar dark">
|
<div className="gh-announcement-bar dark">
|
||||||
<div className="gh-announcement-bar-content" dangerouslySetInnerHTML={{__html: data.content}}></div>
|
<div className="gh-announcement-bar-content" dangerouslySetInnerHTML={{__html: data.content}}></div>
|
||||||
<button>
|
<button onClick={() => setVisible(false)}>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue