Skip to content

Commit

Permalink
fix: hasSidebar in navbar title
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyuan0704 committed Oct 17, 2022
1 parent 6efa733 commit 0c05644
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/theme-default/components/Nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { Search } from '../Search/index';
import { usePageData } from '@client';
import { NavMenuSingleItem } from './NavMenuSingleItem';
import { NavMenuGroup, NavMenuGroupItem } from './NavMenuGroup';
import { useLocaleSiteData } from '../../logic';
import { useLocaleSiteData, useSidebarData } from '../../logic';
import { DefaultTheme } from 'shared/types';
import Translator from '../../assets/translator.svg';
import GithubSvg from '../../assets/github.svg';
import { useLocation } from 'react-router-dom';
export interface NavProps {
beforeNavTitle?: React.ReactNode;
afterNavTitle?: React.ReactNode;
Expand Down Expand Up @@ -133,7 +134,9 @@ const NavSocialLinks = ({
export function Nav(props: NavProps) {
const { beforeNavTitle, afterNavTitle } = props;
const { siteData, pageType } = usePageData();
const hasSidebar = pageType === 'doc';
const { pathname } = useLocation();
const { items: sidebarItems } = useSidebarData(pathname);
const hasSidebar = pageType === 'doc' && sidebarItems.length > 0;
const hasAppearanceSwitch = siteData.appearance !== false;
const localeData = useLocaleSiteData();
const localeLanguages = Object.values(siteData.themeConfig.locales || {});
Expand Down

0 comments on commit 0c05644

Please sign in to comment.