@seqera/docusaurus-theme-seqera 1.0.33 → 1.0.34

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.
@@ -1,15 +1,10 @@
1
- import React from 'react';
1
+ import React, {useState, useEffect} from 'react';
2
2
  import clsx from 'clsx';
3
- import {
4
- useThemeConfig,
5
- ErrorCauseBoundary,
6
- ThemeClassNames,
7
- } from '@docusaurus/theme-common';
3
+ import {useThemeConfig, ThemeClassNames} from '@docusaurus/theme-common';
8
4
  import {
9
5
  splitNavbarItems,
10
6
  useNavbarMobileSidebar,
11
7
  } from '@docusaurus/theme-common/internal';
12
- import {useLocation} from '@docusaurus/router';
13
8
  import NavbarItem from '@theme/NavbarItem';
14
9
  import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
15
10
  import SearchBar from '@theme/SearchBar';
@@ -18,30 +13,18 @@ import NavbarLogo from '@theme/Navbar/Logo';
18
13
  import Submenu from '../Submenu';
19
14
  import styles from './styles.module.css';
20
15
  function useNavbarItems() {
21
- // TODO temporary casting until ThemeConfig type is improved
22
16
  return useThemeConfig().navbar.items;
23
17
  }
24
18
  function NavbarItems({items}) {
25
19
  return (
26
20
  <>
27
21
  {items.map((item, i) => (
28
- <ErrorCauseBoundary
29
- key={i}
30
- onError={(error) =>
31
- new Error(
32
- `A theme navbar item failed to render.
33
- Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
34
- ${JSON.stringify(item, null, 2)}`,
35
- {cause: error},
36
- )
37
- }>
38
- <NavbarItem {...item} />
39
- </ErrorCauseBoundary>
22
+ <NavbarItem key={i} {...item} />
40
23
  ))}
41
24
  </>
42
25
  );
43
26
  }
44
- function NavbarContentLayout({left, right, isMenuOpen}) {
27
+ function NavbarContentLayout({left, right}) {
45
28
  return (
46
29
  <div className="navbar__inner">
47
30
  <div
@@ -67,10 +50,12 @@ function NavbarContentLayout({left, right, isMenuOpen}) {
67
50
  }
68
51
  export default function NavbarContent() {
69
52
  const mobileSidebar = useNavbarMobileSidebar();
70
- const {pathname} = useLocation();
53
+ const [pathname, setPathname] = useState('');
54
+ useEffect(() => {
55
+ setPathname(window.location.pathname);
56
+ }, []);
71
57
  const items = useNavbarItems();
72
58
  const [leftItems, rightItems] = splitNavbarItems(items);
73
- const searchBarItem = items.find((item) => item.type === 'search');
74
59
  return (
75
60
  <div className="w-full flex flex-col justify-center md:justify-start">
76
61
  <div className="md:pt-3 md:pb-1">
@@ -90,10 +75,11 @@ export default function NavbarContent() {
90
75
  </div>
91
76
  <div className="hidden md:flex!">
92
77
  <a
93
- className="btn btn-secondary mr-2 "
78
+ className="btn btn-secondary mr-2"
94
79
  href="https://cloud.seqera.io/oauth/login/auth0">
95
80
  Log In
96
81
  </a>
82
+
97
83
  <a
98
84
  className="btn btn-outline"
99
85
  href="https://cloud.seqera.io/oauth/login/auth0">
@@ -108,7 +94,6 @@ export default function NavbarContent() {
108
94
  <div className="hidden md:flex! text-[.9rem] pt-1">
109
95
  <div className="flex flex-row justify-between w-full">
110
96
  <div>
111
- {/* <NavbarItems items={leftItems} /> */}
112
97
  <a
113
98
  className={clsx(
114
99
  'navbar__link font-normal',
@@ -119,6 +104,7 @@ export default function NavbarContent() {
119
104
  aria-label="Platform Cloud">
120
105
  Cloud
121
106
  </a>
107
+
122
108
  <a
123
109
  className={clsx(
124
110
  'navbar__link ml-8 font-normal',
@@ -126,18 +112,20 @@ export default function NavbarContent() {
126
112
  'navbar__link--active',
127
113
  )}
128
114
  href="/platform-enterprise/"
129
- aria-label="Changelog">
115
+ aria-label="Enterprise">
130
116
  Enterprise
131
117
  </a>
118
+
132
119
  <a
133
120
  className={clsx(
134
121
  'navbar__link ml-8 font-normal',
135
122
  pathname.startsWith('/nextflow/') && 'navbar__link--active',
136
123
  )}
137
124
  href="/nextflow/"
138
- aria-label="Changelog">
125
+ aria-label="Nextflow">
139
126
  Nextflow
140
127
  </a>
128
+
141
129
  <a
142
130
  className={clsx(
143
131
  'navbar__link ml-8 font-normal',
@@ -147,6 +135,7 @@ export default function NavbarContent() {
147
135
  aria-label="MultiQC">
148
136
  MultiQC
149
137
  </a>
138
+
150
139
  <a
151
140
  className={clsx(
152
141
  'navbar__link ml-8 font-normal',
@@ -156,6 +145,7 @@ export default function NavbarContent() {
156
145
  aria-label="Wave">
157
146
  Wave
158
147
  </a>
148
+
159
149
  <a
160
150
  className={clsx(
161
151
  'navbar__link ml-8 font-normal',
@@ -176,6 +166,7 @@ export default function NavbarContent() {
176
166
  aria-label="Platform API">
177
167
  Platform API
178
168
  </a>
169
+
179
170
  <a
180
171
  className={clsx(
181
172
  'navbar__link ml-8 font-normal',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seqera/docusaurus-theme-seqera",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "description": "Seqera docs theme for Docusaurus",
5
5
  "author": "Seqera docs team <education@seqera.io>",
6
6
  "license": "Apache-2.0",
@@ -1,26 +1,19 @@
1
- import React, {type ReactNode} from 'react';
1
+ import React, {type ReactNode, useState, useEffect} from 'react';
2
2
  import clsx from 'clsx';
3
- import {
4
- useThemeConfig,
5
- ErrorCauseBoundary,
6
- ThemeClassNames,
7
- } from '@docusaurus/theme-common';
3
+ import {useThemeConfig, ThemeClassNames} from '@docusaurus/theme-common';
8
4
  import {
9
5
  splitNavbarItems,
10
6
  useNavbarMobileSidebar,
11
7
  } from '@docusaurus/theme-common/internal';
12
- import {useLocation} from '@docusaurus/router';
13
8
  import NavbarItem, {type Props as NavbarItemConfig} from '@theme/NavbarItem';
14
9
  import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
15
10
  import SearchBar from '@theme/SearchBar';
16
11
  import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
17
12
  import NavbarLogo from '@theme/Navbar/Logo';
18
- import NavbarSearch from '@theme/Navbar/Search';
19
13
  import Submenu from '../Submenu';
20
14
  import styles from './styles.module.css';
21
15
 
22
16
  function useNavbarItems() {
23
- // TODO temporary casting until ThemeConfig type is improved
24
17
  return useThemeConfig().navbar.items as NavbarItemConfig[];
25
18
  }
26
19
 
@@ -28,18 +21,7 @@ function NavbarItems({items}: {items: NavbarItemConfig[]}): ReactNode {
28
21
  return (
29
22
  <>
30
23
  {items.map((item, i) => (
31
- <ErrorCauseBoundary
32
- key={i}
33
- onError={(error) =>
34
- new Error(
35
- `A theme navbar item failed to render.
36
- Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
37
- ${JSON.stringify(item, null, 2)}`,
38
- {cause: error},
39
- )
40
- }>
41
- <NavbarItem {...item} />
42
- </ErrorCauseBoundary>
24
+ <NavbarItem key={i} {...item} />
43
25
  ))}
44
26
  </>
45
27
  );
@@ -48,11 +30,9 @@ ${JSON.stringify(item, null, 2)}`,
48
30
  function NavbarContentLayout({
49
31
  left,
50
32
  right,
51
- isMenuOpen,
52
33
  }: {
53
34
  left: ReactNode;
54
35
  right: ReactNode;
55
- isMenuOpen?: boolean | undefined;
56
36
  }) {
57
37
  return (
58
38
  <div className="navbar__inner">
@@ -80,13 +60,15 @@ function NavbarContentLayout({
80
60
 
81
61
  export default function NavbarContent(): ReactNode {
82
62
  const mobileSidebar = useNavbarMobileSidebar();
83
- const {pathname} = useLocation();
63
+ const [pathname, setPathname] = useState('');
64
+
65
+ useEffect(() => {
66
+ setPathname(window.location.pathname);
67
+ }, []);
84
68
 
85
69
  const items = useNavbarItems();
86
70
  const [leftItems, rightItems] = splitNavbarItems(items);
87
71
 
88
- const searchBarItem = items.find((item) => item.type === 'search');
89
-
90
72
  return (
91
73
  <div className="w-full flex flex-col justify-center md:justify-start">
92
74
  <div className="md:pt-3 md:pb-1">
@@ -106,10 +88,11 @@ export default function NavbarContent(): ReactNode {
106
88
  </div>
107
89
  <div className="hidden md:flex!">
108
90
  <a
109
- className="btn btn-secondary mr-2 "
91
+ className="btn btn-secondary mr-2"
110
92
  href="https://cloud.seqera.io/oauth/login/auth0">
111
93
  Log In
112
94
  </a>
95
+
113
96
  <a
114
97
  className="btn btn-outline"
115
98
  href="https://cloud.seqera.io/oauth/login/auth0">
@@ -124,7 +107,6 @@ export default function NavbarContent(): ReactNode {
124
107
  <div className="hidden md:flex! text-[.9rem] pt-1">
125
108
  <div className="flex flex-row justify-between w-full">
126
109
  <div>
127
- {/* <NavbarItems items={leftItems} /> */}
128
110
  <a
129
111
  className={clsx(
130
112
  'navbar__link font-normal',
@@ -135,6 +117,7 @@ export default function NavbarContent(): ReactNode {
135
117
  aria-label="Platform Cloud">
136
118
  Cloud
137
119
  </a>
120
+
138
121
  <a
139
122
  className={clsx(
140
123
  'navbar__link ml-8 font-normal',
@@ -142,18 +125,20 @@ export default function NavbarContent(): ReactNode {
142
125
  'navbar__link--active',
143
126
  )}
144
127
  href="/platform-enterprise/"
145
- aria-label="Changelog">
128
+ aria-label="Enterprise">
146
129
  Enterprise
147
130
  </a>
131
+
148
132
  <a
149
133
  className={clsx(
150
134
  'navbar__link ml-8 font-normal',
151
135
  pathname.startsWith('/nextflow/') && 'navbar__link--active',
152
136
  )}
153
137
  href="/nextflow/"
154
- aria-label="Changelog">
138
+ aria-label="Nextflow">
155
139
  Nextflow
156
140
  </a>
141
+
157
142
  <a
158
143
  className={clsx(
159
144
  'navbar__link ml-8 font-normal',
@@ -163,6 +148,7 @@ export default function NavbarContent(): ReactNode {
163
148
  aria-label="MultiQC">
164
149
  MultiQC
165
150
  </a>
151
+
166
152
  <a
167
153
  className={clsx(
168
154
  'navbar__link ml-8 font-normal',
@@ -172,6 +158,7 @@ export default function NavbarContent(): ReactNode {
172
158
  aria-label="Wave">
173
159
  Wave
174
160
  </a>
161
+
175
162
  <a
176
163
  className={clsx(
177
164
  'navbar__link ml-8 font-normal',
@@ -192,6 +179,7 @@ export default function NavbarContent(): ReactNode {
192
179
  aria-label="Platform API">
193
180
  Platform API
194
181
  </a>
182
+
195
183
  <a
196
184
  className={clsx(
197
185
  'navbar__link ml-8 font-normal',