Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme-classic): avoid rendering empty search box container #7990

Closed
wants to merge 8 commits into from
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-classic/src/theme-classic.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ declare module '@theme/Navbar/Search' {
readonly className?: string;
}

export default function NavbarSearch(props: Props): JSX.Element;
export default function NavbarSearch(props: Props): JSX.Element | null;
}

declare module '@theme/NavbarItem/DefaultNavbarItem' {
Expand Down Expand Up @@ -1117,7 +1117,7 @@ declare module '@theme/PaginatorNavLink' {
}

declare module '@theme/SearchBar' {
export default function SearchBar(): JSX.Element;
export default function SearchBar(): JSX.Element | null;
}

declare module '@theme/TabItem' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import styles from './styles.module.css';
export default function NavbarSearch({
children,
className,
}: Props): JSX.Element {
}: Props): JSX.Element | null {
if (!children) {
return null;
}
return <div className={clsx(className, styles.searchBox)}>{children}</div>;
}