Skip to content

Commit

Permalink
Avoid rendering empty search container if site has no search plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 8, 2023
1 parent 77b3b54 commit ed36538
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export default function NavbarSearch({
children,
className,
}: Props): JSX.Element {
return <div className={clsx(className, styles.searchBox)}>{children}</div>;
return <div className={clsx(className, styles.navbarSearch)}>{children}</div>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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/7990
*/
.navbarSearch:not(:has(> *)) {
display: none;
}

@media (max-width: 996px) {
.searchBox {
.navbarSearch {
position: absolute;
right: var(--ifm-navbar-padding-horizontal);
}
}

@media (min-width: 997px) {
.searchBox {
.navbarSearch {
padding: var(--ifm-navbar-item-padding-vertical)
var(--ifm-navbar-item-padding-horizontal);
}
Expand Down

0 comments on commit ed36538

Please sign in to comment.