@docusaurus/theme-classic 0.0.0-4364 → 0.0.0-4375

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 (35) hide show
  1. package/lib/theme-classic.d.ts +46 -27
  2. package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +3 -3
  3. package/lib-next/theme/DocItem/index.js +6 -2
  4. package/lib-next/theme/DocSidebar/index.js +1 -1
  5. package/lib-next/theme/DocSidebarItem/index.js +3 -16
  6. package/lib-next/theme/DocSidebarItems/index.js +26 -0
  7. package/lib-next/theme/DocSidebarItems/styles.module.css +19 -0
  8. package/lib-next/theme/Heading/index.js +39 -42
  9. package/lib-next/theme/MDXComponents/index.js +6 -6
  10. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +4 -66
  11. package/lib-next/theme/NavbarItem/DocNavbarItem.js +1 -1
  12. package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +1 -1
  13. package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +5 -5
  14. package/lib-next/theme/NavbarItem/NavbarNavLink.js +70 -0
  15. package/lib-next/theme/NavbarItem/index.js +0 -2
  16. package/lib-next/theme/NavbarItem/utils.js +9 -0
  17. package/lib-next/theme/hooks/useDocs.js +1 -0
  18. package/package.json +12 -12
  19. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +3 -3
  20. package/src/theme/DocItem/index.tsx +6 -2
  21. package/src/theme/DocSidebar/index.tsx +1 -1
  22. package/src/theme/DocSidebarItem/index.tsx +3 -19
  23. package/src/theme/DocSidebarItems/index.tsx +31 -0
  24. package/src/theme/DocSidebarItems/styles.module.css +19 -0
  25. package/src/theme/Heading/index.tsx +39 -46
  26. package/src/theme/MDXComponents/index.tsx +6 -6
  27. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +6 -62
  28. package/src/theme/NavbarItem/DocNavbarItem.tsx +1 -1
  29. package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +3 -2
  30. package/src/theme/NavbarItem/DropdownNavbarItem.tsx +5 -5
  31. package/src/theme/NavbarItem/NavbarNavLink.tsx +68 -0
  32. package/src/theme/NavbarItem/index.tsx +0 -3
  33. package/src/theme/NavbarItem/utils.ts +10 -0
  34. package/src/theme/hooks/useDocs.ts +1 -0
  35. package/src/theme-classic.d.ts +46 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4364",
3
+ "version": "0.0.0-4375",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -23,14 +23,14 @@
23
23
  "update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
24
24
  },
25
25
  "dependencies": {
26
- "@docusaurus/core": "0.0.0-4364",
27
- "@docusaurus/plugin-content-blog": "0.0.0-4364",
28
- "@docusaurus/plugin-content-docs": "0.0.0-4364",
29
- "@docusaurus/plugin-content-pages": "0.0.0-4364",
30
- "@docusaurus/theme-common": "0.0.0-4364",
31
- "@docusaurus/theme-translations": "0.0.0-4364",
32
- "@docusaurus/utils": "0.0.0-4364",
33
- "@docusaurus/utils-validation": "0.0.0-4364",
26
+ "@docusaurus/core": "0.0.0-4375",
27
+ "@docusaurus/plugin-content-blog": "0.0.0-4375",
28
+ "@docusaurus/plugin-content-docs": "0.0.0-4375",
29
+ "@docusaurus/plugin-content-pages": "0.0.0-4375",
30
+ "@docusaurus/theme-common": "0.0.0-4375",
31
+ "@docusaurus/theme-translations": "0.0.0-4375",
32
+ "@docusaurus/utils": "0.0.0-4375",
33
+ "@docusaurus/utils-validation": "0.0.0-4375",
34
34
  "@mdx-js/mdx": "^1.6.21",
35
35
  "@mdx-js/react": "^1.6.21",
36
36
  "clsx": "^1.1.1",
@@ -45,8 +45,8 @@
45
45
  "rtlcss": "^3.3.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@docusaurus/module-type-aliases": "0.0.0-4364",
49
- "@docusaurus/types": "0.0.0-4364",
48
+ "@docusaurus/module-type-aliases": "0.0.0-4375",
49
+ "@docusaurus/types": "0.0.0-4375",
50
50
  "@types/mdx-js__react": "^1.5.4",
51
51
  "@types/parse-numeric-range": "^0.0.1",
52
52
  "@types/rtlcss": "^3.1.1",
@@ -61,5 +61,5 @@
61
61
  "engines": {
62
62
  "node": ">=14"
63
63
  },
64
- "gitHead": "db9cb5ab444107d56734f4e8405721484197d0a9"
64
+ "gitHead": "5738b5a5cb1c7446430167058e8d246fe6b596de"
65
65
  }
@@ -13,7 +13,7 @@ import DocPaginator from '@theme/DocPaginator';
13
13
  import Seo from '@theme/Seo';
14
14
  import DocVersionBanner from '@theme/DocVersionBanner';
15
15
  import DocVersionBadge from '@theme/DocVersionBadge';
16
- import {MainHeading} from '@theme/Heading';
16
+ import Heading from '@theme/Heading';
17
17
  import useBaseUrl from '@docusaurus/useBaseUrl';
18
18
 
19
19
  import styles from './styles.module.css';
@@ -35,9 +35,9 @@ export default function DocCategoryGeneratedIndexPage({
35
35
  <DocVersionBanner />
36
36
  <DocVersionBadge />
37
37
  <header>
38
- <MainHeading className={styles.title}>
38
+ <Heading as="h1" className={styles.title}>
39
39
  {categoryGeneratedIndex.title}
40
- </MainHeading>
40
+ </Heading>
41
41
  {categoryGeneratedIndex.description && (
42
42
  <p>{categoryGeneratedIndex.description}</p>
43
43
  )}
@@ -16,7 +16,7 @@ import type {Props} from '@theme/DocItem';
16
16
  import DocItemFooter from '@theme/DocItemFooter';
17
17
  import TOC from '@theme/TOC';
18
18
  import TOCCollapsible from '@theme/TOCCollapsible';
19
- import {MainHeading} from '@theme/Heading';
19
+ import Heading from '@theme/Heading';
20
20
  import styles from './styles.module.css';
21
21
  import {ThemeClassNames} from '@docusaurus/theme-common';
22
22
 
@@ -80,7 +80,11 @@ export default function DocItem(props: Props): JSX.Element {
80
80
  To make both cases consistent, the added title is added under the same div.markdown block
81
81
  See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
82
82
  */}
83
- {shouldAddTitle && <MainHeading>{title}</MainHeading>}
83
+ {shouldAddTitle && (
84
+ <header>
85
+ <Heading as="h1">{title}</Heading>
86
+ </header>
87
+ )}
84
88
 
85
89
  <DocContent />
86
90
  </div>
@@ -19,7 +19,7 @@ import useWindowSize from '@theme/hooks/useWindowSize';
19
19
  import Logo from '@theme/Logo';
20
20
  import IconArrow from '@theme/IconArrow';
21
21
  import {translate} from '@docusaurus/Translate';
22
- import {DocSidebarItems} from '@theme/DocSidebarItem';
22
+ import DocSidebarItems from '@theme/DocSidebarItems';
23
23
  import type {Props} from '@theme/DocSidebar';
24
24
 
25
25
  import styles from './styles.module.css';
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {useEffect, memo, useMemo} from 'react';
8
+ import React, {useEffect, useMemo} from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {
11
11
  isActiveSidebarItem,
@@ -20,7 +20,8 @@ import isInternalUrl from '@docusaurus/isInternalUrl';
20
20
  import {translate} from '@docusaurus/Translate';
21
21
  import IconExternalLink from '@theme/IconExternalLink';
22
22
 
23
- import type {Props, DocSidebarItemsProps} from '@theme/DocSidebarItem';
23
+ import DocSidebarItems from '@theme/DocSidebarItems';
24
+ import type {Props} from '@theme/DocSidebarItem';
24
25
  import type {
25
26
  PropSidebarItemCategory,
26
27
  PropSidebarItemLink,
@@ -29,23 +30,6 @@ import type {
29
30
  import styles from './styles.module.css';
30
31
  import useIsBrowser from '@docusaurus/useIsBrowser';
31
32
 
32
- // Optimize sidebar at each "level"
33
- // TODO this item should probably not receive the "activePath" props
34
- // TODO this triggers whole sidebar re-renders on navigation
35
- export const DocSidebarItems = memo(
36
- ({items, ...props}: DocSidebarItemsProps): JSX.Element => (
37
- <>
38
- {items.map((item, index) => (
39
- <DocSidebarItem
40
- key={index} // sidebar is static, the index does not change
41
- item={item}
42
- {...props}
43
- />
44
- ))}
45
- </>
46
- ),
47
- );
48
-
49
33
  export default function DocSidebarItem({
50
34
  item,
51
35
  ...props
@@ -0,0 +1,31 @@
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, {memo} from 'react';
9
+
10
+ import DocSidebarItem from '@theme/DocSidebarItem';
11
+
12
+ import type {Props} from '@theme/DocSidebarItems';
13
+
14
+ // TODO this item should probably not receive the "activePath" props
15
+ // TODO this triggers whole sidebar re-renders on navigation
16
+ function DocSidebarItems({items, ...props}: Props): JSX.Element {
17
+ return (
18
+ <>
19
+ {items.map((item, index) => (
20
+ <DocSidebarItem
21
+ key={index} // sidebar is static, the index does not change
22
+ item={item}
23
+ {...props}
24
+ />
25
+ ))}
26
+ </>
27
+ );
28
+ }
29
+
30
+ // Optimize sidebar at each "level"
31
+ export default memo(DocSidebarItems);
@@ -0,0 +1,19 @@
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
+ .menuLinkText {
10
+ cursor: initial;
11
+ }
12
+ .menuLinkText:hover {
13
+ background: none;
14
+ }
15
+
16
+ .menuLinkText.hasHref {
17
+ cursor: pointer;
18
+ }
19
+ }
@@ -7,62 +7,55 @@
7
7
 
8
8
  import React from 'react';
9
9
  import clsx from 'clsx';
10
- import type {HeadingType, Props} from '@theme/Heading';
10
+ import type {Props} from '@theme/Heading';
11
11
  import {translate} from '@docusaurus/Translate';
12
12
  import {useThemeConfig} from '@docusaurus/theme-common';
13
13
 
14
14
  import './styles.css';
15
15
  import styles from './styles.module.css';
16
16
 
17
- type HeadingComponent = (props: Props) => JSX.Element;
17
+ function AnchorHeading({as: As, id, ...props}: Props) {
18
+ const {
19
+ navbar: {hideOnScroll},
20
+ } = useThemeConfig();
18
21
 
19
- // eslint-disable-next-line react/function-component-definition
20
- export const MainHeading: HeadingComponent = ({...props}) => (
21
- <header>
22
- <h1
22
+ if (!id) {
23
+ return <As {...props} />;
24
+ }
25
+
26
+ return (
27
+ <As
23
28
  {...props}
24
- id={undefined} // h1 headings do not need an id because they don't appear in the TOC
25
- >
29
+ className={clsx('anchor', {
30
+ [styles.anchorWithHideOnScrollNavbar]: hideOnScroll,
31
+ [styles.anchorWithStickyNavbar]: !hideOnScroll,
32
+ })}
33
+ id={id}>
26
34
  {props.children}
27
- </h1>
28
- </header>
29
- );
30
-
31
- const createAnchorHeading =
32
- (Tag: HeadingType) =>
33
- ({id, ...props}: Props) => {
34
- const {
35
- navbar: {hideOnScroll},
36
- } = useThemeConfig();
37
-
38
- if (!id) {
39
- return <Tag {...props} />;
40
- }
41
-
35
+ <a
36
+ className="hash-link"
37
+ href={`#${id}`}
38
+ title={translate({
39
+ id: 'theme.common.headingLinkTitle',
40
+ message: 'Direct link to heading',
41
+ description: 'Title for link to heading',
42
+ })}>
43
+ &#8203;
44
+ </a>
45
+ </As>
46
+ );
47
+ }
48
+
49
+ export default function Heading({as, ...props}: Props) {
50
+ if (as === 'h1') {
42
51
  return (
43
- <Tag
52
+ <h1
44
53
  {...props}
45
- className={clsx('anchor', {
46
- [styles.anchorWithHideOnScrollNavbar]: hideOnScroll,
47
- [styles.anchorWithStickyNavbar]: !hideOnScroll,
48
- })}
49
- id={id}>
54
+ id={undefined} // h1 headings do not need an id because they don't appear in the TOC
55
+ >
50
56
  {props.children}
51
- <a
52
- className="hash-link"
53
- href={`#${id}`}
54
- title={translate({
55
- id: 'theme.common.headingLinkTitle',
56
- message: 'Direct link to heading',
57
- description: 'Title for link to heading',
58
- })}>
59
- &#8203;
60
- </a>
61
- </Tag>
57
+ </h1>
62
58
  );
63
- };
64
-
65
- const Heading = (headingType: HeadingType): ((props: Props) => JSX.Element) =>
66
- headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
67
-
68
- export default Heading;
59
+ }
60
+ return <AnchorHeading as={as} {...props} />;
61
+ }
@@ -67,12 +67,12 @@ const MDXComponents: MDXComponentsObject = {
67
67
  </Details>
68
68
  );
69
69
  },
70
- h1: Heading('h1'),
71
- h2: Heading('h2'),
72
- h3: Heading('h3'),
73
- h4: Heading('h4'),
74
- h5: Heading('h5'),
75
- h6: Heading('h6'),
70
+ h1: (props) => <Heading as="h1" {...props} />,
71
+ h2: (props) => <Heading as="h2" {...props} />,
72
+ h3: (props) => <Heading as="h3" {...props} />,
73
+ h4: (props) => <Heading as="h4" {...props} />,
74
+ h5: (props) => <Heading as="h5" {...props} />,
75
+ h6: (props) => <Heading as="h6" {...props} />,
76
76
  };
77
77
 
78
78
  export default MDXComponents;
@@ -7,71 +7,15 @@
7
7
 
8
8
  import React from 'react';
9
9
  import clsx from 'clsx';
10
- import Link from '@docusaurus/Link';
11
- import useBaseUrl from '@docusaurus/useBaseUrl';
10
+
11
+ import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
12
+
12
13
  import type {
13
- NavLinkProps,
14
14
  DesktopOrMobileNavBarItemProps,
15
15
  Props,
16
16
  } from '@theme/NavbarItem/DefaultNavbarItem';
17
- import IconExternalLink from '@theme/IconExternalLink';
18
- import isInternalUrl from '@docusaurus/isInternalUrl';
19
- import {isRegexpStringMatch} from '@docusaurus/theme-common';
20
- import {getInfimaActiveClassName} from './index';
21
-
22
- const dropdownLinkActiveClass = 'dropdown__link--active';
23
-
24
- export function NavLink({
25
- activeBasePath,
26
- activeBaseRegex,
27
- to,
28
- href,
29
- label,
30
- activeClassName = '',
31
- prependBaseUrlToHref,
32
- ...props
33
- }: NavLinkProps): JSX.Element {
34
- // TODO all this seems hacky
35
- // {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
36
- const toUrl = useBaseUrl(to);
37
- const activeBaseUrl = useBaseUrl(activeBasePath);
38
- const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
39
- const isExternalLink = label && href && !isInternalUrl(href);
40
- const isDropdownLink = activeClassName === dropdownLinkActiveClass;
41
17
 
42
- return (
43
- <Link
44
- {...(href
45
- ? {
46
- href: prependBaseUrlToHref ? normalizedHref : href,
47
- }
48
- : {
49
- isNavLink: true,
50
- activeClassName: !props.className?.includes(activeClassName)
51
- ? activeClassName
52
- : '',
53
- to: toUrl,
54
- ...(activeBasePath || activeBaseRegex
55
- ? {
56
- isActive: (_match, location) =>
57
- activeBaseRegex
58
- ? isRegexpStringMatch(activeBaseRegex, location.pathname)
59
- : location.pathname.startsWith(activeBaseUrl),
60
- }
61
- : null),
62
- })}
63
- {...props}>
64
- {isExternalLink ? (
65
- <span>
66
- {label}
67
- <IconExternalLink {...(isDropdownLink && {width: 12, height: 12})} />
68
- </span>
69
- ) : (
70
- label
71
- )}
72
- </Link>
73
- );
74
- }
18
+ import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
75
19
 
76
20
  function DefaultNavbarItemDesktop({
77
21
  className,
@@ -79,7 +23,7 @@ function DefaultNavbarItemDesktop({
79
23
  ...props
80
24
  }: DesktopOrMobileNavBarItemProps) {
81
25
  const element = (
82
- <NavLink
26
+ <NavbarNavLink
83
27
  className={clsx(
84
28
  isDropdownItem ? 'dropdown__link' : 'navbar__item navbar__link',
85
29
  className,
@@ -102,7 +46,7 @@ function DefaultNavbarItemMobile({
102
46
  }: DesktopOrMobileNavBarItemProps) {
103
47
  return (
104
48
  <li className="menu__list-item">
105
- <NavLink className={clsx('menu__link', className)} {...props} />
49
+ <NavbarNavLink className={clsx('menu__link', className)} {...props} />
106
50
  </li>
107
51
  );
108
52
  }
@@ -9,7 +9,7 @@ import React from 'react';
9
9
  import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
10
10
  import {useLatestVersion, useActiveDocContext} from '@theme/hooks/useDocs';
11
11
  import clsx from 'clsx';
12
- import {getInfimaActiveClassName} from './index';
12
+ import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
13
13
  import type {Props} from '@theme/NavbarItem/DocNavbarItem';
14
14
  import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
15
15
  import type {GlobalDataVersion} from '@docusaurus/plugin-content-docs';
@@ -9,9 +9,10 @@ import React from 'react';
9
9
  import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
10
10
  import {useLatestVersion, useActiveDocContext} from '@theme/hooks/useDocs';
11
11
  import clsx from 'clsx';
12
- import {getInfimaActiveClassName} from './index';
13
- import type {Props} from '@theme/NavbarItem/DocSidebarNavbarItem';
12
+ import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
14
13
  import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
14
+
15
+ import type {Props} from '@theme/NavbarItem/DocSidebarNavbarItem';
15
16
  import type {
16
17
  GlobalDataVersion,
17
18
  GlobalDataSidebar,
@@ -20,7 +20,7 @@ import type {
20
20
  } from '@theme/NavbarItem/DropdownNavbarItem';
21
21
  import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
22
22
 
23
- import {NavLink} from '@theme/NavbarItem/DefaultNavbarItem';
23
+ import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
24
24
  import NavbarItem from '@theme/NavbarItem';
25
25
 
26
26
  const dropdownLinkActiveClass = 'dropdown__link--active';
@@ -84,7 +84,7 @@ function DropdownNavbarItemDesktop({
84
84
  'dropdown--right': position === 'right',
85
85
  'dropdown--show': showDropdown,
86
86
  })}>
87
- <NavLink
87
+ <NavbarNavLink
88
88
  href={props.to ? undefined : '#'}
89
89
  className={clsx('navbar__link', className)}
90
90
  {...props}
@@ -96,7 +96,7 @@ function DropdownNavbarItemDesktop({
96
96
  }
97
97
  }}>
98
98
  {props.children ?? props.label}
99
- </NavLink>
99
+ </NavbarNavLink>
100
100
  <ul className="dropdown__menu">
101
101
  {items.map((childItemProps, i) => (
102
102
  <NavbarItem
@@ -146,7 +146,7 @@ function DropdownNavbarItemMobile({
146
146
  className={clsx('menu__list-item', {
147
147
  'menu__list-item--collapsed': collapsed,
148
148
  })}>
149
- <NavLink
149
+ <NavbarNavLink
150
150
  role="button"
151
151
  className={clsx('menu__link menu__link--sublist', className)}
152
152
  {...props}
@@ -155,7 +155,7 @@ function DropdownNavbarItemMobile({
155
155
  toggleCollapsed();
156
156
  }}>
157
157
  {props.children ?? props.label}
158
- </NavLink>
158
+ </NavbarNavLink>
159
159
  <Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
160
160
  {items.map((childItemProps, i) => (
161
161
  <NavbarItem
@@ -0,0 +1,68 @@
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 Link from '@docusaurus/Link';
10
+ import useBaseUrl from '@docusaurus/useBaseUrl';
11
+ import type {Props} from '@theme/NavbarItem/NavbarNavLink';
12
+ import IconExternalLink from '@theme/IconExternalLink';
13
+ import isInternalUrl from '@docusaurus/isInternalUrl';
14
+ import {isRegexpStringMatch} from '@docusaurus/theme-common';
15
+
16
+ const dropdownLinkActiveClass = 'dropdown__link--active';
17
+
18
+ export default function NavbarNavLink({
19
+ activeBasePath,
20
+ activeBaseRegex,
21
+ to,
22
+ href,
23
+ label,
24
+ activeClassName = '',
25
+ prependBaseUrlToHref,
26
+ ...props
27
+ }: Props): JSX.Element {
28
+ // TODO all this seems hacky
29
+ // {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
30
+ const toUrl = useBaseUrl(to);
31
+ const activeBaseUrl = useBaseUrl(activeBasePath);
32
+ const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
33
+ const isExternalLink = label && href && !isInternalUrl(href);
34
+ const isDropdownLink = activeClassName === dropdownLinkActiveClass;
35
+
36
+ return (
37
+ <Link
38
+ {...(href
39
+ ? {
40
+ href: prependBaseUrlToHref ? normalizedHref : href,
41
+ }
42
+ : {
43
+ isNavLink: true,
44
+ activeClassName: !props.className?.includes(activeClassName)
45
+ ? activeClassName
46
+ : '',
47
+ to: toUrl,
48
+ ...(activeBasePath || activeBaseRegex
49
+ ? {
50
+ isActive: (_match, location) =>
51
+ activeBaseRegex
52
+ ? isRegexpStringMatch(activeBaseRegex, location.pathname)
53
+ : location.pathname.startsWith(activeBaseUrl),
54
+ }
55
+ : null),
56
+ })}
57
+ {...props}>
58
+ {isExternalLink ? (
59
+ <span>
60
+ {label}
61
+ <IconExternalLink {...(isDropdownLink && {width: 12, height: 12})} />
62
+ </span>
63
+ ) : (
64
+ label
65
+ )}
66
+ </Link>
67
+ );
68
+ }
@@ -58,9 +58,6 @@ function getComponentType(
58
58
  return type as NavbarItemComponentType;
59
59
  }
60
60
 
61
- export const getInfimaActiveClassName = (mobile?: boolean): string =>
62
- mobile ? 'menu__link--active' : 'navbar__link--active';
63
-
64
61
  export default function NavbarItem({type, ...props}: Props): JSX.Element {
65
62
  const componentType = getComponentType(
66
63
  type,
@@ -0,0 +1,10 @@
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
+ // eslint-disable-next-line import/no-named-export
9
+ export const getInfimaActiveClassName = (mobile?: boolean): string =>
10
+ mobile ? 'menu__link--active' : 'navbar__link--active';
@@ -8,4 +8,5 @@
8
8
  // Re-expose useDocs
9
9
  // Ensure it's always statically available even if user is not using the docs plugin
10
10
  // Problem reported for the blog-only mode: https://github.com/facebook/docusaurus/issues/3360
11
+ // eslint-disable-next-line import/no-named-export
11
12
  export * from '@docusaurus/plugin-content-docs/lib/theme/hooks/useDocs';