@docusaurus/theme-classic 0.0.0-4860 → 0.0.0-4865

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -692,6 +692,16 @@ declare module '@theme/Navbar/MobileSidebar/Header' {
692
692
  export default function NavbarMobileSidebarHeader(): JSX.Element;
693
693
  }
694
694
 
695
+ declare module '@theme/Navbar/Search' {
696
+ import type {ReactNode} from 'react';
697
+
698
+ export interface Props {
699
+ readonly children: ReactNode;
700
+ }
701
+
702
+ export default function NavbarSearch(props: Props): JSX.Element;
703
+ }
704
+
695
705
  declare module '@theme/NavbarItem/DefaultNavbarItem' {
696
706
  import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
697
707
 
@@ -796,7 +806,9 @@ declare module '@theme/NavbarItem/DocNavbarItem' {
796
806
  readonly docsPluginId?: string;
797
807
  }
798
808
 
799
- export default function DocsSidebarNavbarItem(props: Props): JSX.Element;
809
+ export default function DocsSidebarNavbarItem(
810
+ props: Props,
811
+ ): JSX.Element | null;
800
812
  }
801
813
 
802
814
  declare module '@theme/NavbarItem/DocSidebarNavbarItem' {
@@ -15,6 +15,7 @@ import {
15
15
  } from '@docusaurus/theme-common';
16
16
  import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
17
17
  import NavbarLogo from '@theme/Navbar/Logo';
18
+ import NavbarSearch from '@theme/Navbar/Search';
18
19
  import styles from './styles.module.css';
19
20
 
20
21
  function useNavbarItems() {
@@ -62,7 +63,11 @@ export default function NavbarContent() {
62
63
  <>
63
64
  <NavbarItems items={rightItems} />
64
65
  <NavbarColorModeToggle className={styles.colorModeToggle} />
65
- {autoAddSearchBar && <SearchBar />}
66
+ {autoAddSearchBar && (
67
+ <NavbarSearch>
68
+ <SearchBar />
69
+ </NavbarSearch>
70
+ )}
66
71
  </>
67
72
  }
68
73
  />
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ import styles from './styles.module.css';
9
+ export default function NavbarSearch({children}) {
10
+ return <div className={styles.searchBox}>{children}</div>;
11
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ @media (max-width: 996px) {
9
+ .searchBox {
10
+ position: absolute;
11
+ right: var(--ifm-navbar-padding-horizontal);
12
+ }
13
+ }
14
+
15
+ @media (min-width: 997px) {
16
+ .searchBox {
17
+ padding: var(--ifm-navbar-item-padding-vertical)
18
+ var(--ifm-navbar-item-padding-horizontal);
19
+ }
20
+ }
@@ -17,7 +17,12 @@ export default function DocNavbarItem({
17
17
  ...props
18
18
  }) {
19
19
  const {activeDoc} = useActiveDocContext(docsPluginId);
20
- const doc = useLayoutDoc(docId, docsPluginId);
20
+ const doc = useLayoutDoc(docId, docsPluginId); // Draft items are not displayed in the navbar.
21
+
22
+ if (doc === null) {
23
+ return null;
24
+ }
25
+
21
26
  const activeDocInfimaClassName = getInfimaActiveClassName(props.mobile);
22
27
  return (
23
28
  <DefaultNavbarItem
@@ -6,10 +6,15 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import SearchBar from '@theme/SearchBar';
9
+ import NavbarSearch from '@theme/Navbar/Search';
9
10
  export default function SearchNavbarItem({mobile}) {
10
11
  if (mobile) {
11
12
  return null;
12
13
  }
13
14
 
14
- return <SearchBar />;
15
+ return (
16
+ <NavbarSearch>
17
+ <SearchBar />
18
+ </NavbarSearch>
19
+ );
15
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4860",
3
+ "version": "0.0.0-4865",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4860",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4860",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4860",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4860",
28
- "@docusaurus/theme-common": "0.0.0-4860",
29
- "@docusaurus/theme-translations": "0.0.0-4860",
30
- "@docusaurus/utils": "0.0.0-4860",
31
- "@docusaurus/utils-common": "0.0.0-4860",
32
- "@docusaurus/utils-validation": "0.0.0-4860",
24
+ "@docusaurus/core": "0.0.0-4865",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4865",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4865",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4865",
28
+ "@docusaurus/theme-common": "0.0.0-4865",
29
+ "@docusaurus/theme-translations": "0.0.0-4865",
30
+ "@docusaurus/utils": "0.0.0-4865",
31
+ "@docusaurus/utils-common": "0.0.0-4865",
32
+ "@docusaurus/utils-validation": "0.0.0-4865",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -45,8 +45,8 @@
45
45
  "@babel/cli": "^7.17.6",
46
46
  "@babel/core": "^7.17.9",
47
47
  "@babel/preset-typescript": "^7.16.7",
48
- "@docusaurus/module-type-aliases": "0.0.0-4860",
49
- "@docusaurus/types": "0.0.0-4860",
48
+ "@docusaurus/module-type-aliases": "0.0.0-4865",
49
+ "@docusaurus/types": "0.0.0-4865",
50
50
  "@types/mdx-js__react": "^1.5.5",
51
51
  "@types/prismjs": "^1.26.0",
52
52
  "@types/rtlcss": "^3.1.3",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=14"
64
64
  },
65
- "gitHead": "dd89ce688ef649f835f2bf6be614c6997ba47165"
65
+ "gitHead": "3bfec620587180f9e7dad2bf2a2713172be65fe7"
66
66
  }
@@ -17,6 +17,7 @@ import {
17
17
  } from '@docusaurus/theme-common';
18
18
  import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
19
19
  import NavbarLogo from '@theme/Navbar/Logo';
20
+ import NavbarSearch from '@theme/Navbar/Search';
20
21
  import styles from './styles.module.css';
21
22
 
22
23
  function useNavbarItems() {
@@ -73,7 +74,11 @@ export default function NavbarContent(): JSX.Element {
73
74
  <>
74
75
  <NavbarItems items={rightItems} />
75
76
  <NavbarColorModeToggle className={styles.colorModeToggle} />
76
- {autoAddSearchBar && <SearchBar />}
77
+ {autoAddSearchBar && (
78
+ <NavbarSearch>
79
+ <SearchBar />
80
+ </NavbarSearch>
81
+ )}
77
82
  </>
78
83
  }
79
84
  />
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import React from 'react';
9
+ import type {Props} from '@theme/Navbar/Search';
10
+
11
+ import styles from './styles.module.css';
12
+
13
+ export default function NavbarSearch({children}: Props): JSX.Element {
14
+ return <div className={styles.searchBox}>{children}</div>;
15
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ @media (max-width: 996px) {
9
+ .searchBox {
10
+ position: absolute;
11
+ right: var(--ifm-navbar-padding-horizontal);
12
+ }
13
+ }
14
+
15
+ @media (min-width: 997px) {
16
+ .searchBox {
17
+ padding: var(--ifm-navbar-item-padding-vertical)
18
+ var(--ifm-navbar-item-padding-horizontal);
19
+ }
20
+ }
@@ -18,9 +18,15 @@ export default function DocNavbarItem({
18
18
  label: staticLabel,
19
19
  docsPluginId,
20
20
  ...props
21
- }: Props): JSX.Element {
21
+ }: Props): JSX.Element | null {
22
22
  const {activeDoc} = useActiveDocContext(docsPluginId);
23
23
  const doc = useLayoutDoc(docId, docsPluginId);
24
+
25
+ // Draft items are not displayed in the navbar.
26
+ if (doc === null) {
27
+ return null;
28
+ }
29
+
24
30
  const activeDocInfimaClassName = getInfimaActiveClassName(props.mobile);
25
31
 
26
32
  return (
@@ -8,11 +8,16 @@
8
8
  import React from 'react';
9
9
  import type {Props} from '@theme/NavbarItem/SearchNavbarItem';
10
10
  import SearchBar from '@theme/SearchBar';
11
+ import NavbarSearch from '@theme/Navbar/Search';
11
12
 
12
13
  export default function SearchNavbarItem({mobile}: Props): JSX.Element | null {
13
14
  if (mobile) {
14
15
  return null;
15
16
  }
16
17
 
17
- return <SearchBar />;
18
+ return (
19
+ <NavbarSearch>
20
+ <SearchBar />
21
+ </NavbarSearch>
22
+ );
18
23
  }
@@ -692,6 +692,16 @@ declare module '@theme/Navbar/MobileSidebar/Header' {
692
692
  export default function NavbarMobileSidebarHeader(): JSX.Element;
693
693
  }
694
694
 
695
+ declare module '@theme/Navbar/Search' {
696
+ import type {ReactNode} from 'react';
697
+
698
+ export interface Props {
699
+ readonly children: ReactNode;
700
+ }
701
+
702
+ export default function NavbarSearch(props: Props): JSX.Element;
703
+ }
704
+
695
705
  declare module '@theme/NavbarItem/DefaultNavbarItem' {
696
706
  import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
697
707
 
@@ -796,7 +806,9 @@ declare module '@theme/NavbarItem/DocNavbarItem' {
796
806
  readonly docsPluginId?: string;
797
807
  }
798
808
 
799
- export default function DocsSidebarNavbarItem(props: Props): JSX.Element;
809
+ export default function DocsSidebarNavbarItem(
810
+ props: Props,
811
+ ): JSX.Element | null;
800
812
  }
801
813
 
802
814
  declare module '@theme/NavbarItem/DocSidebarNavbarItem' {