docs: redesigned announcement bar (#2559)

This commit is contained in:
Shahed Nasser
2022-11-07 14:13:54 +02:00
committed by GitHub
parent f7126fc9e1
commit bbf4039147
13 changed files with 257 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ import styles from './styles.module.css';
import DocSidebarItem from '@theme/DocSidebarItem';
import SearchBar from '../../SearchBar';
import useIsBrowser from '@docusaurus/useIsBrowser';
import AnnouncementBar from '@theme/AnnouncementBar';
function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
const {
@@ -21,18 +22,12 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
const sidebarRef = useRef(null)
useEffect(() => {
console.log("here1", isBrowser, sidebarRef.current)
if (isBrowser && sidebarRef.current) {
console.log("here2")
function handleScroll () {
console.log("handlescroll")
if (!sidebarRef.current.classList.contains('scrolling')) {
console.log("scrolling")
sidebarRef.current.classList.add('scrolling');
const intervalId = setInterval(() => {
console.log("interval")
if (!sidebarRef.current.matches(':hover')) {
console.log("remove class")
sidebarRef.current.classList.remove('scrolling');
clearInterval(intervalId);
}
@@ -62,6 +57,7 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
<div className={styles.sidebarSearchContainer}>
<SearchBar />
</div>
<AnnouncementBar />
<Content path={path} sidebar={sidebar} />
{sidebarFooter.length > 0 && (
<ul className={