refactor(theme-classic): split sidebar into smaller parts (#6844)

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Sébastien Lorber 2022-03-10 16:55:30 +01:00 committed by GitHub
parent e412d367a0
commit e97dc0d37e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 366 additions and 228 deletions

View file

@ -0,0 +1,30 @@
/**
* 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 Content from '@theme-original/DocSidebar/Desktop/Content';
import {useLocation} from '@docusaurus/router';
function SidebarAd() {
return (
<div style={{border: 'solid thin red', padding: 10, textAlign: 'center'}}>
Sidebar Ad
</div>
);
}
export default function ContentWrapper(props) {
const {pathname} = useLocation();
const shouldShowSidebarAd = pathname.includes('/tests/');
return (
<>
{shouldShowSidebarAd && <SidebarAd />}
<Content {...props} />
{shouldShowSidebarAd && <SidebarAd />}
</>
);
}