mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 20:32:42 +02:00
refactor(theme-classic): split sidebar into smaller parts (#6844)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
e412d367a0
commit
e97dc0d37e
12 changed files with 366 additions and 228 deletions
30
website/src/theme/DocSidebar/Desktop/Content/index.js
Normal file
30
website/src/theme/DocSidebar/Desktop/Content/index.js
Normal 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 />}
|
||||
</>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue