forked from Uniswap/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add layout and get sidebar data
- Loading branch information
1 parent
d05fa87
commit 66324b3
Showing
5 changed files
with
88 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { FC } from 'react' | ||
|
||
import { useDocsData } from '@docusaurus/plugin-content-docs/client' | ||
|
||
const Sidebar: FC = () => { | ||
React.useEffect(() => { | ||
const main = document.getElementById('new-main') | ||
const sidebars = main.getElementsByTagName('aside') | ||
Array.from(sidebars).map((sidebar) => { | ||
if (sidebar.id !== 'new-sidebar') { | ||
sidebar.remove() | ||
} | ||
}) | ||
}, []) | ||
const visibleItems = useDocsData(undefined) | ||
console.log('!!!', visibleItems) | ||
return ( | ||
<aside id="new-sidebar" className="w-sidebar-w"> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
<div>new sidebar</div> | ||
</aside> | ||
) | ||
} | ||
|
||
export default Sidebar |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { FC } from 'react' | ||
|
||
import LayoutProvider from '@theme/Layout/Provider' | ||
import { PageMetadata } from '@docusaurus/theme-common' | ||
import Navbar from '@theme/Navbar' | ||
import Footer from '@theme/Footer' | ||
import type { Props } from '@theme/Layout' | ||
import Sidebar from '../components/Sidebar' | ||
|
||
const Layout: FC<Props> = ({ title, description, children }) => { | ||
return ( | ||
<LayoutProvider> | ||
<PageMetadata title={title} description={description} /> | ||
<Navbar /> | ||
<main id="new-main" className="pt-nav-h min-h-screen flex flex-row"> | ||
<Sidebar /> | ||
<div className="">{children}</div> | ||
</main> | ||
<Footer /> | ||
</LayoutProvider> | ||
) | ||
} | ||
|
||
export default Layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters