Skip to content

Commit

Permalink
last updates
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Mar 18, 2022
1 parent dfad62b commit 44d447a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@

import React, {type ComponentProps} from 'react';
import {useNavbarSecondaryMenu, useThemeConfig} from '@docusaurus/theme-common';
import type {Props as NavbarItemConfig} from '@theme/NavbarItem';
import Translate from '@docusaurus/Translate';

function useIsPrimaryMenuEmpty() {
// TODO temporary casting until ThemeConfig type is improved
return (useThemeConfig().navbar.items as NavbarItemConfig[]).length === 0;
}

function SecondaryMenuBackButton(props: ComponentProps<'button'>) {
return (
<button {...props} type="button" className="clean-btn navbar-sidebar__back">
Expand All @@ -30,7 +24,7 @@ function SecondaryMenuBackButton(props: ComponentProps<'button'>) {
// The secondary menu slides from the right and shows contextual information
// such as the docs sidebar
export default function NavbarMobileSidebarSecondaryMenu(): JSX.Element | null {
const isPrimaryMenuEmpty = useIsPrimaryMenuEmpty();
const isPrimaryMenuEmpty = useThemeConfig().navbar.items.length === 0;
const secondaryMenu = useNavbarSecondaryMenu();
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function NavbarSecondaryMenuFiller<
}

function renderElement(state: State): JSX.Element | undefined {
if (state.content && state.content.component) {
if (state.content?.component) {
const Comp = state.content.component;
return <Comp {...state.content.props} />;
}
Expand Down

0 comments on commit 44d447a

Please sign in to comment.