@vantagecompute/docusaurus-theme 0.1.3 → 0.2.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantagecompute/docusaurus-theme",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Shared Vantage Compute Docusaurus theme — design system, brand assets, and common theme overrides for all vantagecompute documentation sites.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import {memo} from 'react'
2
2
  import clsx from 'clsx'
3
3
  import useIsBrowser from '@docusaurus/useIsBrowser'
4
4
  import { translate } from '@docusaurus/Translate'
@@ -57,4 +57,4 @@ function ColorModeToggle({ className, buttonClassName, value, onChange }) {
57
57
  </div>
58
58
  )
59
59
  }
60
- export default React.memo(ColorModeToggle)
60
+ export default memo(ColorModeToggle)
@@ -2,7 +2,6 @@
2
2
  * Custom DocBreadcrumbs component that ensures full path representation
3
3
  * e.g., Home -> Platform -> <platform page>
4
4
  */
5
- import React from 'react';
6
5
  import clsx from 'clsx';
7
6
  import {ThemeClassNames} from '@docusaurus/theme-common';
8
7
  import {useSidebarBreadcrumbs} from '@docusaurus/plugin-content-docs/client';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import {useNavbarSecondaryMenu} from '@docusaurus/theme-common/internal';
3
2
 
4
3
  export default function NavbarMobileSidebarSecondaryMenu() {
@@ -11,7 +11,7 @@
11
11
  * `useTabsContextValue` (for value extraction) and the rendered
12
12
  * `TabsContainer`.
13
13
  */
14
- import React from 'react';
14
+ import {useRef} from 'react';
15
15
  import clsx from 'clsx';
16
16
  import {ThemeClassNames} from '@docusaurus/theme-common';
17
17
  import {
@@ -26,12 +26,12 @@ import styles from './styles.module.css';
26
26
 
27
27
  function TabList({className}) {
28
28
  const {selectedValue, selectValue, tabValues, block} = useTabs();
29
- const tabRefs = [];
29
+ const tabRefs = useRef([]);
30
30
  const {blockElementScrollPositionUntilNextRender} =
31
31
  useScrollPositionBlocker();
32
32
  const handleTabChange = (event) => {
33
33
  const newTab = event.currentTarget;
34
- const newTabIndex = tabRefs.indexOf(newTab);
34
+ const newTabIndex = tabRefs.current.indexOf(newTab);
35
35
  const newTabValue = tabValues[newTabIndex].value;
36
36
  if (newTabValue !== selectedValue) {
37
37
  blockElementScrollPositionUntilNextRender(newTab);
@@ -46,13 +46,13 @@ function TabList({className}) {
46
46
  break;
47
47
  }
48
48
  case 'ArrowRight': {
49
- const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
50
- focusElement = tabRefs[nextTab] ?? tabRefs[0];
49
+ const nextTab = tabRefs.current.indexOf(event.currentTarget) + 1;
50
+ focusElement = tabRefs.current[nextTab] ?? tabRefs.current[0];
51
51
  break;
52
52
  }
53
53
  case 'ArrowLeft': {
54
- const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
55
- focusElement = tabRefs[prevTab] ?? tabRefs[tabRefs.length - 1];
54
+ const prevTab = tabRefs.current.indexOf(event.currentTarget) - 1;
55
+ focusElement = tabRefs.current[prevTab] ?? tabRefs.current[tabRefs.current.length - 1];
56
56
  break;
57
57
  }
58
58
  default:
@@ -78,7 +78,7 @@ function TabList({className}) {
78
78
  aria-selected={selectedValue === value}
79
79
  key={value}
80
80
  ref={(ref) => {
81
- tabRefs.push(ref);
81
+ tabRefs.current.push(ref);
82
82
  }}
83
83
  onKeyDown={handleKeydown}
84
84
  onClick={handleTabChange}