mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-14 20:24:56 +02:00
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
import React from 'react';
|
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
import {useAnnouncementBar} from '@docusaurus/theme-common/internal';
|
|
import AnnouncementBarCloseButton from '@theme/AnnouncementBar/CloseButton';
|
|
import AnnouncementBarContent from '@theme/AnnouncementBar/Content';
|
|
import styles from './styles.module.css';
|
|
export default function AnnouncementBar() {
|
|
const {announcementBar} = useThemeConfig();
|
|
const {isActive, close} = useAnnouncementBar();
|
|
if (!isActive) {
|
|
return null;
|
|
}
|
|
const {backgroundColor, textColor, isCloseable} = announcementBar;
|
|
return (
|
|
<div
|
|
className={styles.announcementBar}
|
|
style={{backgroundColor, color: textColor}}
|
|
role="banner">
|
|
{isCloseable && <div className={styles.announcementBarPlaceholder} />}
|
|
<AnnouncementBarContent className={styles.announcementBarContent} />
|
|
{isCloseable && (
|
|
<AnnouncementBarCloseButton
|
|
onClick={close}
|
|
className={styles.announcementBarClose}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|