@docusaurus/theme-classic 0.0.0-4705 → 0.0.0-4709

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.
Files changed (45) hide show
  1. package/lib/getSwizzleConfig.js +50 -2
  2. package/lib/theme-classic.d.ts +107 -0
  3. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
  4. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
  5. package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
  6. package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
  7. package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
  8. package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
  9. package/lib-next/theme/DocSidebar/Mobile/index.js +45 -0
  10. package/lib-next/theme/DocSidebar/index.js +6 -113
  11. package/lib-next/theme/Footer/Copyright/index.js +18 -0
  12. package/lib-next/theme/Footer/Layout/index.js +26 -0
  13. package/lib-next/theme/Footer/LinkItem/index.js +35 -0
  14. package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
  15. package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
  16. package/lib-next/theme/Footer/Links/index.js +17 -0
  17. package/lib-next/theme/Footer/Logo/index.js +38 -0
  18. package/lib-next/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
  19. package/lib-next/theme/Footer/index.js +11 -156
  20. package/lib-next/theme/MDXComponents/index.js +1 -1
  21. package/lib-next/theme/Tabs/index.js +2 -2
  22. package/package.json +13 -13
  23. package/src/getSwizzleConfig.ts +52 -1
  24. package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
  25. package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
  26. package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
  27. package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
  28. package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
  29. package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
  30. package/src/theme/DocSidebar/Mobile/index.tsx +51 -0
  31. package/src/theme/DocSidebar/index.tsx +6 -121
  32. package/src/theme/Footer/Copyright/index.tsx +22 -0
  33. package/src/theme/Footer/Layout/index.tsx +34 -0
  34. package/src/theme/Footer/LinkItem/index.tsx +38 -0
  35. package/src/theme/Footer/Links/MultiColumn/index.tsx +53 -0
  36. package/src/theme/Footer/Links/Simple/index.tsx +44 -0
  37. package/src/theme/Footer/Links/index.tsx +21 -0
  38. package/src/theme/Footer/Logo/index.tsx +41 -0
  39. package/src/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
  40. package/src/theme/Footer/index.tsx +12 -170
  41. package/src/theme/MDXComponents/index.tsx +2 -2
  42. package/src/theme/Tabs/index.tsx +1 -2
  43. package/src/theme-classic.d.ts +107 -0
  44. package/lib-next/theme/DocSidebar/styles.module.css +0 -107
  45. package/src/theme/DocSidebar/styles.module.css +0 -107
@@ -0,0 +1,47 @@
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 LinkItem from '@theme/Footer/LinkItem';
9
+
10
+ function ColumnLinkItem({item}) {
11
+ return item.html ? (
12
+ <li
13
+ className="footer__item" // Developer provided the HTML, so assume it's safe.
14
+ // eslint-disable-next-line react/no-danger
15
+ dangerouslySetInnerHTML={{
16
+ __html: item.html,
17
+ }}
18
+ />
19
+ ) : (
20
+ <li key={item.href || item.to} className="footer__item">
21
+ <LinkItem item={item} />
22
+ </li>
23
+ );
24
+ }
25
+
26
+ function Column({column}) {
27
+ return (
28
+ <div className="col footer__col">
29
+ <div className="footer__title">{column.title}</div>
30
+ <ul className="footer__items">
31
+ {column.items.map((item, i) => (
32
+ <ColumnLinkItem key={i} item={item} />
33
+ ))}
34
+ </ul>
35
+ </div>
36
+ );
37
+ }
38
+
39
+ export default function FooterLinksMultiColumn({columns}) {
40
+ return (
41
+ <div className="row footer__links">
42
+ {columns.map((column, i) => (
43
+ <Column key={i} column={column} />
44
+ ))}
45
+ </div>
46
+ );
47
+ }
@@ -0,0 +1,41 @@
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 LinkItem from '@theme/Footer/LinkItem';
9
+
10
+ function Separator() {
11
+ return <span className="footer__link-separator">·</span>;
12
+ }
13
+
14
+ function SimpleLinkItem({item}) {
15
+ return item.html ? (
16
+ <span
17
+ className="footer__link-item" // Developer provided the HTML, so assume it's safe.
18
+ // eslint-disable-next-line react/no-danger
19
+ dangerouslySetInnerHTML={{
20
+ __html: item.html,
21
+ }}
22
+ />
23
+ ) : (
24
+ <LinkItem item={item} />
25
+ );
26
+ }
27
+
28
+ export default function FooterLinksSimple({links}) {
29
+ return (
30
+ <div className="footer__links text--center">
31
+ <div className="footer__links">
32
+ {links.map((item, i) => (
33
+ <React.Fragment key={i}>
34
+ <SimpleLinkItem item={item} />
35
+ {links.length !== i + 1 && <Separator />}
36
+ </React.Fragment>
37
+ ))}
38
+ </div>
39
+ </div>
40
+ );
41
+ }
@@ -0,0 +1,17 @@
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 {isMultiColumnFooterLinks} from '@docusaurus/theme-common';
9
+ import FooterLinksMultiColumn from '@theme/Footer/Links/MultiColumn';
10
+ import FooterLinksSimple from '@theme/Footer/Links/Simple';
11
+ export default function FooterLinks({links}) {
12
+ return isMultiColumnFooterLinks(links) ? (
13
+ <FooterLinksMultiColumn columns={links} />
14
+ ) : (
15
+ <FooterLinksSimple links={links} />
16
+ );
17
+ }
@@ -0,0 +1,38 @@
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 Link from '@docusaurus/Link';
9
+ import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
10
+ import styles from './styles.module.css';
11
+ import ThemedImage from '@theme/ThemedImage';
12
+
13
+ function LogoImage({logo}) {
14
+ const {withBaseUrl} = useBaseUrlUtils();
15
+ const sources = {
16
+ light: withBaseUrl(logo.src),
17
+ dark: withBaseUrl(logo.srcDark ?? logo.src),
18
+ };
19
+ return (
20
+ <ThemedImage
21
+ className="footer__logo"
22
+ alt={logo.alt}
23
+ sources={sources}
24
+ width={logo.width}
25
+ height={logo.height}
26
+ />
27
+ );
28
+ }
29
+
30
+ export default function FooterLogo({logo}) {
31
+ return logo.href ? (
32
+ <Link href={logo.href} className={styles.footerLogoLink}>
33
+ <LogoImage logo={logo} />
34
+ </Link>
35
+ ) : (
36
+ <LogoImage logo={logo} />
37
+ );
38
+ }
@@ -5,130 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- import clsx from 'clsx';
9
- import Link from '@docusaurus/Link';
10
8
  import {useThemeConfig} from '@docusaurus/theme-common';
11
- import useBaseUrl, {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
12
- import isInternalUrl from '@docusaurus/isInternalUrl';
13
- import styles from './styles.module.css';
14
- import ThemedImage from '@theme/ThemedImage';
15
- import IconExternalLink from '@theme/IconExternalLink';
16
-
17
- function FooterLink({to, href, label, prependBaseUrlToHref, ...props}) {
18
- const toUrl = useBaseUrl(to);
19
- const normalizedHref = useBaseUrl(href, {
20
- forcePrependBaseUrl: true,
21
- });
22
- return (
23
- <Link
24
- className="footer__link-item"
25
- {...(href
26
- ? {
27
- href: prependBaseUrlToHref ? normalizedHref : href,
28
- }
29
- : {
30
- to: toUrl,
31
- })}
32
- {...props}>
33
- <span>
34
- {label}
35
- {href && !isInternalUrl(href) && <IconExternalLink />}
36
- </span>
37
- </Link>
38
- );
39
- }
40
-
41
- function FooterLogo({logo}) {
42
- const {withBaseUrl} = useBaseUrlUtils();
43
-
44
- if (!logo?.src) {
45
- return null;
46
- }
47
-
48
- const sources = {
49
- light: withBaseUrl(logo.src),
50
- dark: withBaseUrl(logo.srcDark ?? logo.src),
51
- };
52
- const image = (
53
- <ThemedImage
54
- className="footer__logo"
55
- alt={logo.alt}
56
- sources={sources}
57
- width={logo.width}
58
- height={logo.height}
59
- />
60
- );
61
- return (
62
- <div className="margin-bottom--sm">
63
- {logo.href ? (
64
- <Link href={logo.href} className={styles.footerLogoLink}>
65
- {image}
66
- </Link>
67
- ) : (
68
- image
69
- )}
70
- </div>
71
- );
72
- }
73
-
74
- function MultiColumnLinks({links}) {
75
- return (
76
- <>
77
- {links.map((linkItem, i) => (
78
- <div key={i} className="col footer__col">
79
- <div className="footer__title">{linkItem.title}</div>
80
- <ul className="footer__items">
81
- {linkItem.items.map((item, key) =>
82
- item.html ? (
83
- <li
84
- key={key}
85
- className="footer__item" // Developer provided the HTML, so assume it's safe.
86
- // eslint-disable-next-line react/no-danger
87
- dangerouslySetInnerHTML={{
88
- __html: item.html,
89
- }}
90
- />
91
- ) : (
92
- <li key={item.href || item.to} className="footer__item">
93
- <FooterLink {...item} />
94
- </li>
95
- ),
96
- )}
97
- </ul>
98
- </div>
99
- ))}
100
- </>
101
- );
102
- }
103
-
104
- function SimpleLinks({links}) {
105
- return (
106
- <div className="footer__links">
107
- {links.map((item, key) => (
108
- <React.Fragment key={key}>
109
- {item.html ? (
110
- <span
111
- className="footer__link-item" // Developer provided the HTML, so assume it's safe.
112
- // eslint-disable-next-line react/no-danger
113
- dangerouslySetInnerHTML={{
114
- __html: item.html,
115
- }}
116
- />
117
- ) : (
118
- <FooterLink {...item} />
119
- )}
120
- {links.length !== key + 1 && (
121
- <span className="footer__link-separator">·</span>
122
- )}
123
- </React.Fragment>
124
- ))}
125
- </div>
126
- );
127
- }
128
-
129
- function isMultiColumnFooterLinks(links) {
130
- return 'title' in links[0];
131
- }
9
+ import FooterLinks from '@theme/Footer/Links';
10
+ import FooterLogo from '@theme/Footer/Logo';
11
+ import FooterCopyright from '@theme/Footer/Copyright';
12
+ import FooterLayout from '@theme/Footer/Layout';
132
13
 
133
14
  function Footer() {
134
15
  const {footer} = useThemeConfig();
@@ -137,40 +18,14 @@ function Footer() {
137
18
  return null;
138
19
  }
139
20
 
140
- const {copyright, links, logo} = footer;
21
+ const {copyright, links, logo, style} = footer;
141
22
  return (
142
- <footer
143
- className={clsx('footer', {
144
- 'footer--dark': footer.style === 'dark',
145
- })}>
146
- <div className="container container-fluid">
147
- {links &&
148
- links.length > 0 &&
149
- (isMultiColumnFooterLinks(links) ? (
150
- <div className="row footer__links">
151
- <MultiColumnLinks links={links} />
152
- </div>
153
- ) : (
154
- <div className="footer__links text--center">
155
- <SimpleLinks links={links} />
156
- </div>
157
- ))}
158
- {(logo || copyright) && (
159
- <div className="footer__bottom text--center">
160
- <FooterLogo logo={logo} />
161
- {copyright && (
162
- <div
163
- className="footer__copyright" // Developer provided the HTML, so assume it's safe.
164
- // eslint-disable-next-line react/no-danger
165
- dangerouslySetInnerHTML={{
166
- __html: copyright,
167
- }}
168
- />
169
- )}
170
- </div>
171
- )}
172
- </div>
173
- </footer>
23
+ <FooterLayout
24
+ style={style}
25
+ links={links && links.length > 0 && <FooterLinks links={links} />}
26
+ logo={logo && <FooterLogo logo={logo} />}
27
+ copyright={copyright && <FooterCopyright copyright={copyright} />}
28
+ />
174
29
  );
175
30
  }
176
31
 
@@ -45,7 +45,7 @@ const MDXComponents = {
45
45
  const shouldBeInline = React.Children.toArray(props.children).every(
46
46
  (el) =>
47
47
  (typeof el === 'string' && !el.includes('\n')) ||
48
- (React.isValidElement(el) && inlineElements.includes(el.props.mdxType)),
48
+ (isValidElement(el) && inlineElements.includes(el.props.mdxType)),
49
49
  );
50
50
  return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
51
51
  },
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, {useState, cloneElement, Children, isValidElement} from 'react';
7
+ import React, {useState, cloneElement, isValidElement} from 'react';
8
8
  import useIsBrowser from '@docusaurus/useIsBrowser';
9
9
  import {
10
10
  useScrollPositionBlocker,
@@ -28,7 +28,7 @@ function TabsComponent(props) {
28
28
  groupId,
29
29
  className,
30
30
  } = props;
31
- const children = Children.map(props.children, (child) => {
31
+ const children = React.Children.map(props.children, (child) => {
32
32
  if (isValidElement(child) && isTabItem(child)) {
33
33
  return child;
34
34
  } // child.type.name will give non-sensical values in prod because of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4705",
3
+ "version": "0.0.0-4709",
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-4705",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4705",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4705",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4705",
28
- "@docusaurus/theme-common": "0.0.0-4705",
29
- "@docusaurus/theme-translations": "0.0.0-4705",
30
- "@docusaurus/utils": "0.0.0-4705",
31
- "@docusaurus/utils-common": "0.0.0-4705",
32
- "@docusaurus/utils-validation": "0.0.0-4705",
24
+ "@docusaurus/core": "0.0.0-4709",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4709",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4709",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4709",
28
+ "@docusaurus/theme-common": "0.0.0-4709",
29
+ "@docusaurus/theme-translations": "0.0.0-4709",
30
+ "@docusaurus/utils": "0.0.0-4709",
31
+ "@docusaurus/utils-common": "0.0.0-4709",
32
+ "@docusaurus/utils-validation": "0.0.0-4709",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -42,8 +42,8 @@
42
42
  "rtlcss": "^3.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4705",
46
- "@docusaurus/types": "0.0.0-4705",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4709",
46
+ "@docusaurus/types": "0.0.0-4709",
47
47
  "@types/mdx-js__react": "^1.5.5",
48
48
  "@types/prismjs": "^1.26.0",
49
49
  "@types/rtlcss": "^3.1.2",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=14"
61
61
  },
62
- "gitHead": "6bf7b983d9b8de15c1dce1f1bdaa27dc0158c156"
62
+ "gitHead": "37703bedb84fd65c6352c5e67a1c3baf84eb59ed"
63
63
  }
@@ -37,11 +37,62 @@ export default function getSwizzleConfig(): SwizzleConfig {
37
37
  },
38
38
  Footer: {
39
39
  actions: {
40
- eject: 'unsafe', // TODO split footer into smaller parts
40
+ eject: 'safe',
41
41
  wrap: 'safe',
42
42
  },
43
43
  description: "The footer component of you site's layout",
44
44
  },
45
+ 'Footer/Copyright': {
46
+ actions: {
47
+ eject: 'safe',
48
+ wrap: 'safe',
49
+ },
50
+ description: 'The footer copyright',
51
+ },
52
+ 'Footer/Layout': {
53
+ actions: {
54
+ eject: 'safe',
55
+ wrap: 'safe',
56
+ },
57
+ description: 'The footer main layout component',
58
+ },
59
+ 'Footer/LinkItem': {
60
+ actions: {
61
+ eject: 'safe',
62
+ wrap: 'safe',
63
+ },
64
+ description: 'The footer link item component',
65
+ },
66
+ 'Footer/Links': {
67
+ actions: {
68
+ eject: 'safe',
69
+ wrap: 'safe',
70
+ },
71
+ description: 'The footer component rendering the footer links',
72
+ },
73
+ 'Footer/Links/MultiColumn': {
74
+ actions: {
75
+ eject: 'safe',
76
+ wrap: 'safe',
77
+ },
78
+ description:
79
+ 'The footer component rendering the footer links with a multi-column layout',
80
+ },
81
+ 'Footer/Links/Simple': {
82
+ actions: {
83
+ eject: 'safe',
84
+ wrap: 'safe',
85
+ },
86
+ description:
87
+ 'The footer component rendering the footer links with a simple layout (single row)',
88
+ },
89
+ 'Footer/Logo': {
90
+ actions: {
91
+ eject: 'safe',
92
+ wrap: 'safe',
93
+ },
94
+ description: 'The footer logo',
95
+ },
45
96
  IconArrow: {
46
97
  actions: {
47
98
  eject: 'safe',
@@ -0,0 +1,38 @@
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 clsx from 'clsx';
10
+ import IconArrow from '@theme/IconArrow';
11
+ import {translate} from '@docusaurus/Translate';
12
+ import type {Props} from '@theme/DocSidebar/Desktop/CollapseButton';
13
+
14
+ import styles from './styles.module.css';
15
+
16
+ export default function CollapseButton({onClick}: Props): JSX.Element {
17
+ return (
18
+ <button
19
+ type="button"
20
+ title={translate({
21
+ id: 'theme.docs.sidebar.collapseButtonTitle',
22
+ message: 'Collapse sidebar',
23
+ description: 'The title attribute for collapse button of doc sidebar',
24
+ })}
25
+ aria-label={translate({
26
+ id: 'theme.docs.sidebar.collapseButtonAriaLabel',
27
+ message: 'Collapse sidebar',
28
+ description: 'The title attribute for collapse button of doc sidebar',
29
+ })}
30
+ className={clsx(
31
+ 'button button--secondary button--outline',
32
+ styles.collapseSidebarButton,
33
+ )}
34
+ onClick={onClick}>
35
+ <IconArrow className={styles.collapseSidebarButtonIcon} />
36
+ </button>
37
+ );
38
+ }
@@ -0,0 +1,44 @@
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
+ :root {
9
+ --collapse-button-bg-color-dark: #2e333a;
10
+ }
11
+
12
+ @media (min-width: 997px) {
13
+ .collapseSidebarButton {
14
+ display: block !important;
15
+ background-color: var(--ifm-button-background-color);
16
+ height: 40px;
17
+ position: sticky;
18
+ bottom: 0;
19
+ border-radius: 0;
20
+ border: 1px solid var(--ifm-toc-border-color);
21
+ }
22
+
23
+ .collapseSidebarButtonIcon {
24
+ transform: rotate(180deg);
25
+ margin-top: 4px;
26
+ }
27
+
28
+ [dir='rtl'] .collapseSidebarButtonIcon {
29
+ transform: rotate(0);
30
+ }
31
+
32
+ [data-theme='dark'] .collapseSidebarButton {
33
+ background-color: var(--collapse-button-bg-color-dark);
34
+ }
35
+
36
+ [data-theme='dark'] .collapseSidebarButton:hover,
37
+ [data-theme='dark'] .collapseSidebarButton:focus {
38
+ background-color: var(--ifm-color-emphasis-200);
39
+ }
40
+ }
41
+
42
+ .collapseSidebarButton {
43
+ display: none;
44
+ }
@@ -0,0 +1,55 @@
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, {useState} from 'react';
9
+ import clsx from 'clsx';
10
+ import {
11
+ ThemeClassNames,
12
+ useAnnouncementBar,
13
+ useScrollPosition,
14
+ } from '@docusaurus/theme-common';
15
+ import DocSidebarItems from '@theme/DocSidebarItems';
16
+ import type {Props} from '@theme/DocSidebar/Desktop/Content';
17
+
18
+ import styles from './styles.module.css';
19
+
20
+ function useShowAnnouncementBar() {
21
+ const {isActive} = useAnnouncementBar();
22
+ const [showAnnouncementBar, setShowAnnouncementBar] = useState(isActive);
23
+
24
+ useScrollPosition(
25
+ ({scrollY}) => {
26
+ if (isActive) {
27
+ setShowAnnouncementBar(scrollY === 0);
28
+ }
29
+ },
30
+ [isActive],
31
+ );
32
+ return isActive && showAnnouncementBar;
33
+ }
34
+
35
+ export default function DocSidebarDesktopContent({
36
+ path,
37
+ sidebar,
38
+ className,
39
+ }: Props): JSX.Element {
40
+ const showAnnouncementBar = useShowAnnouncementBar();
41
+
42
+ return (
43
+ <nav
44
+ className={clsx(
45
+ 'menu thin-scrollbar',
46
+ styles.menu,
47
+ showAnnouncementBar && styles.menuWithAnnouncementBar,
48
+ className,
49
+ )}>
50
+ <ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
51
+ <DocSidebarItems items={sidebar} activePath={path} level={1} />
52
+ </ul>
53
+ </nav>
54
+ );
55
+ }
@@ -0,0 +1,17 @@
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 (min-width: 997px) {
9
+ .menu {
10
+ flex-grow: 1;
11
+ padding: 0.5rem;
12
+ }
13
+
14
+ .menuWithAnnouncementBar {
15
+ margin-bottom: var(--docusaurus-announcement-bar-height);
16
+ }
17
+ }
@@ -0,0 +1,38 @@
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 clsx from 'clsx';
10
+ import {useThemeConfig} from '@docusaurus/theme-common';
11
+ import Logo from '@theme/Logo';
12
+ import CollapseButton from '@theme/DocSidebar/Desktop/CollapseButton';
13
+ import Content from '@theme/DocSidebar/Desktop/Content';
14
+ import type {Props} from '@theme/DocSidebar/Desktop';
15
+
16
+ import styles from './styles.module.css';
17
+
18
+ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}: Props) {
19
+ const {
20
+ navbar: {hideOnScroll},
21
+ hideableSidebar,
22
+ } = useThemeConfig();
23
+
24
+ return (
25
+ <div
26
+ className={clsx(
27
+ styles.sidebar,
28
+ hideOnScroll && styles.sidebarWithHideableNavbar,
29
+ isHidden && styles.sidebarHidden,
30
+ )}>
31
+ {hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
32
+ <Content path={path} sidebar={sidebar} />
33
+ {hideableSidebar && <CollapseButton onClick={onCollapse} />}
34
+ </div>
35
+ );
36
+ }
37
+
38
+ export default React.memo(DocSidebarDesktop);