@redocly/theme 0.40.3 → 0.40.5
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.
|
@@ -46,8 +46,9 @@ function NavbarItem({ navItem, className }) {
|
|
|
46
46
|
if (navItem.type !== 'link' && !navItem.items)
|
|
47
47
|
return null;
|
|
48
48
|
const item = navItem;
|
|
49
|
+
const normalizedPath = item.link && item.link !== '/' ? (0, utils_1.removeTrailingSlash)(item.link) : item.link;
|
|
49
50
|
const isActive = pathname ===
|
|
50
|
-
(0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(
|
|
51
|
+
(0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
|
|
51
52
|
const itemContent = (react_1.default.createElement(NavbarMenuItem, { as: item.link ? Link_1.Link : undefined, active: isActive, className: className, onClick: () => telemetry.send('navbar_menu_item_clicked', { type: item.type }), external: item.external, target: item.target, to: item.link },
|
|
52
53
|
react_1.default.createElement(NavbarIcon, { url: item.icon }),
|
|
53
54
|
react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.5",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
"./package.json": "./package.json",
|
|
15
15
|
"./config.js": "./lib/config.js",
|
|
16
|
-
"./plugin.js": "./
|
|
16
|
+
"./plugin.js": "./src/plugin.js",
|
|
17
17
|
"./config": "./lib/config.js",
|
|
18
18
|
".": "./lib/index.js",
|
|
19
19
|
"./src/": "./src/",
|
|
@@ -7,7 +7,11 @@ import type { LinkProps } from '@redocly/theme/components/Link/Link';
|
|
|
7
7
|
|
|
8
8
|
import { DropdownMenu } from '@redocly/theme/components/Dropdown/DropdownMenu';
|
|
9
9
|
import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getPathnameForLocale,
|
|
12
|
+
withPathPrefix,
|
|
13
|
+
removeTrailingSlash,
|
|
14
|
+
} from '@redocly/theme/core/utils';
|
|
11
15
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
12
16
|
import { LaunchIcon } from '@redocly/theme/icons/LaunchIcon/LaunchIcon';
|
|
13
17
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
@@ -28,10 +32,12 @@ export function NavbarItem({ navItem, className }: NavbarItemProps): JSX.Element
|
|
|
28
32
|
if (navItem.type !== 'link' && !navItem.items) return null;
|
|
29
33
|
|
|
30
34
|
const item = navItem as ResolvedNavLinkItem;
|
|
35
|
+
const normalizedPath =
|
|
36
|
+
item.link && item.link !== '/' ? removeTrailingSlash(item.link) : item.link;
|
|
31
37
|
|
|
32
38
|
const isActive =
|
|
33
39
|
pathname ===
|
|
34
|
-
withPathPrefix(getPathnameForLocale(
|
|
40
|
+
withPathPrefix(getPathnameForLocale(normalizedPath, defaultLocale, currentLocale, locales));
|
|
35
41
|
|
|
36
42
|
const itemContent = (
|
|
37
43
|
<NavbarMenuItem
|
|
File without changes
|