fix(theme): avoid rendering empty search container if site has no search plugin (#9385)

This commit is contained in:
Sébastien Lorber 2023-10-08 20:04:42 +02:00 committed by GitHub
parent 77b3b54def
commit 35441b38e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -15,5 +15,9 @@ export default function NavbarSearch({
children,
className,
}: Props): JSX.Element {
return <div className={clsx(className, styles.searchBox)}>{children}</div>;
return (
<div className={clsx(className, styles.navbarSearchContainer)}>
{children}
</div>
);
}

View file

@ -5,15 +5,23 @@
* LICENSE file in the root directory of this source tree.
*/
/*
Workaround to avoid rendering empty search container
See https://github.com/facebook/docusaurus/pull/9385
*/
.navbarSearchContainer:not(:has(> *)) {
display: none;
}
@media (max-width: 996px) {
.searchBox {
.navbarSearchContainer {
position: absolute;
right: var(--ifm-navbar-padding-horizontal);
}
}
@media (min-width: 997px) {
.searchBox {
.navbarSearchContainer {
padding: var(--ifm-navbar-item-padding-vertical)
var(--ifm-navbar-item-padding-horizontal);
}