Files
supabase/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
T
2022-08-10 14:43:02 -03:00

46 lines
1.3 KiB
JavaScript

import React from 'react'
import Content from '@theme-original/DocSidebar/Desktop/Content'
import { useLocation } from '@docusaurus/router'
import Link from '@docusaurus/Link'
const subNavRoutes = [
// Add any routes which should have a subnav
'/docs/reference/api',
'/docs/reference/cli',
'/docs/reference/auth',
'/docs/reference/storage',
'/docs/reference/javascript',
'/docs/reference/dart',
]
const requiresSubNav = (pathname, routes) => {
return routes.some((route) => pathname.indexOf(route) == 0)
}
export default function ContentWrapper(props) {
const { pathname } = useLocation()
return (
<div className="theme-doc-sidebar-menu-custom-container">
{pathname && requiresSubNav(pathname, subNavRoutes) && (
<Link to="/docs/reference" className="custom--main-menu-button">
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M20.3284 11.0001V13.0001L7.50011 13.0001L10.7426 16.2426L9.32842 17.6568L3.67157 12L9.32842 6.34314L10.7426 7.75735L7.49988 11.0001L20.3284 11.0001Z"
fill="currentColor"
/>
</svg>
<span>All Reference Docs</span>
</Link>
)}
<Content {...props} />
</div>
)
}