@redocly/theme 0.17.1 → 0.18.1
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/lib/I18n/LanguagePicker.js +53 -85
- package/lib/components/Catalog/Catalog.d.ts +1 -1
- package/lib/components/Catalog/useCatalog.d.ts +2 -1
- package/lib/components/Dropdown/Dropdown.d.ts +16 -0
- package/lib/components/Dropdown/Dropdown.js +113 -0
- package/lib/components/Dropdown/index.d.ts +1 -0
- package/lib/components/Dropdown/index.js +18 -0
- package/lib/components/Menu/MenuGroup.js +2 -0
- package/lib/components/Menu/MenuItem.js +2 -0
- package/lib/components/Menu/MobileMenu.d.ts +2 -9
- package/lib/components/Menu/MobileMenu.js +35 -65
- package/lib/components/Menu/MobileMenuGroup.js +2 -0
- package/lib/components/Menu/constants.d.ts +5 -0
- package/lib/components/Menu/constants.js +10 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.d.ts +2 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.js +83 -0
- package/lib/components/Menu/hooks/use-mobile-menu-levels.d.ts +5 -0
- package/lib/components/Menu/hooks/use-mobile-menu-levels.js +50 -0
- package/lib/components/Menu/types.d.ts +3 -0
- package/lib/components/Menu/types.js +3 -0
- package/lib/components/Menu/utils.d.ts +7 -0
- package/lib/components/Menu/utils.js +76 -0
- package/lib/components/Navbar/MobileUserProfile.d.ts +1 -1
- package/lib/components/Navbar/MobileUserProfile.js +4 -7
- package/lib/components/Navbar/Navbar.d.ts +0 -3
- package/lib/components/Navbar/Navbar.js +9 -12
- package/lib/components/Navbar/NavbarItem.d.ts +5 -1
- package/lib/components/Navbar/NavbarItem.js +15 -16
- package/lib/components/Navbar/NavbarMenu.js +1 -1
- package/lib/components/OpenApiDocs/Dropdown.js +5 -5
- package/lib/components/Product/Product.d.ts +7 -0
- package/lib/components/Product/Product.js +23 -0
- package/lib/components/Product/ProductPicker.d.ts +2 -0
- package/lib/components/Product/ProductPicker.js +83 -0
- package/lib/components/Product/index.d.ts +2 -0
- package/lib/components/Product/index.js +19 -0
- package/lib/components/Profile/UserProfile.js +54 -6
- package/lib/components/Search/InputWrapper.js +1 -7
- package/lib/components/Search/ProductTag.d.ts +6 -0
- package/lib/components/Search/ProductTag.js +61 -0
- package/lib/components/Search/SearchDialog.js +19 -4
- package/lib/components/Search/SearchItem.d.ts +2 -1
- package/lib/components/Search/SearchItem.js +13 -2
- package/lib/components/Search/index.d.ts +1 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Select/Select.d.ts +18 -0
- package/lib/components/Select/Select.js +118 -0
- package/lib/components/Select/index.d.ts +1 -0
- package/lib/components/Select/index.js +18 -0
- package/lib/components/Sidebar/DrilldownMenuItem.js +2 -9
- package/lib/components/Sidebar/SidebarItemIcon.d.ts +1 -0
- package/lib/components/Sidebar/SidebarItemIcon.js +16 -0
- package/lib/components/Sidebar/VersionPicker.d.ts +7 -0
- package/lib/components/Sidebar/VersionPicker.js +51 -0
- package/lib/components/Sidebar/index.d.ts +2 -0
- package/lib/components/Sidebar/index.js +2 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/config.d.ts +952 -25
- package/lib/config.js +115 -2
- package/lib/globalStyle.js +177 -16
- package/lib/hooks/useThemeConfig.d.ts +1 -1
- package/lib/hooks/useThemeConfig.js +7 -2
- package/lib/mocks/hooks/index.d.ts +4 -3
- package/lib/mocks/hooks/index.js +6 -2
- package/lib/mocks/search.d.ts +1 -1
- package/lib/mocks/search.js +1 -1
- package/lib/types/portal/src/shared/types/catalog.d.ts +2 -24
- package/lib/types/portal/src/shared/types/nav.d.ts +4 -0
- package/lib/types/portal/src/shared/types/searchDocument.d.ts +2 -0
- package/lib/ui/darkColors.js +2 -0
- package/lib/ui/index.d.ts +0 -1
- package/lib/ui/index.js +0 -1
- package/package.json +1 -1
- package/src/I18n/LanguagePicker.tsx +62 -89
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/useCatalog.ts +2 -3
- package/src/components/Dropdown/Dropdown.tsx +138 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Menu/MenuGroup.tsx +2 -0
- package/src/components/Menu/MenuItem.tsx +2 -0
- package/src/components/Menu/MobileMenu.tsx +43 -96
- package/src/components/Menu/MobileMenuGroup.tsx +2 -0
- package/src/components/Menu/constants.ts +5 -0
- package/src/components/Menu/hooks/use-mobile-menu-items.ts +100 -0
- package/src/components/Menu/hooks/use-mobile-menu-levels.ts +55 -0
- package/src/components/Menu/types.ts +3 -0
- package/src/components/Menu/utils.ts +109 -0
- package/src/components/Navbar/MobileUserProfile.tsx +19 -20
- package/src/components/Navbar/Navbar.tsx +12 -22
- package/src/components/Navbar/NavbarItem.tsx +20 -15
- package/src/components/Navbar/NavbarMenu.tsx +1 -1
- package/src/components/OpenApiDocs/Dropdown.tsx +5 -5
- package/src/components/Product/Product.tsx +28 -0
- package/src/components/Product/ProductPicker.tsx +97 -0
- package/src/components/Product/index.ts +2 -0
- package/src/components/Profile/UserProfile.tsx +80 -21
- package/src/components/Search/InputWrapper.tsx +1 -7
- package/src/components/Search/ProductTag.tsx +46 -0
- package/src/components/Search/SearchDialog.tsx +21 -5
- package/src/components/Search/SearchItem.tsx +17 -3
- package/src/components/Search/index.ts +1 -0
- package/src/components/Select/Select.tsx +140 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Sidebar/DrilldownMenuItem.tsx +2 -10
- package/src/components/Sidebar/SidebarItemIcon.tsx +10 -0
- package/src/components/Sidebar/VersionPicker.tsx +48 -0
- package/src/components/Sidebar/index.ts +2 -0
- package/src/components/index.ts +3 -0
- package/src/config.ts +140 -6
- package/src/globalStyle.ts +181 -16
- package/src/hooks/useThemeConfig.ts +18 -3
- package/src/mocks/hooks/index.ts +9 -3
- package/src/mocks/search.ts +1 -1
- package/src/types/portal/src/shared/types/catalog.ts +2 -26
- package/src/types/portal/src/shared/types/i18n.d.ts +3 -1
- package/src/types/portal/src/shared/types/nav.ts +41 -37
- package/src/types/portal/src/shared/types/searchDocument.ts +7 -4
- package/src/ui/darkColors.tsx +2 -0
- package/src/ui/index.tsx +0 -1
- package/lib/components/Navbar/NavbarDropdown.d.ts +0 -9
- package/lib/components/Navbar/NavbarDropdown.js +0 -40
- package/lib/components/Profile/UserProfileMenu.d.ts +0 -8
- package/lib/components/Profile/UserProfileMenu.js +0 -93
- package/src/components/Navbar/NavbarDropdown.tsx +0 -48
- package/src/components/Profile/UserProfileMenu.tsx +0 -97
|
@@ -11,6 +11,7 @@ export type ResolvedNavLinkItem = {
|
|
|
11
11
|
sidebar?: ResolvedNavItem[]; // for API catalog it contains the corresponding sidebar first item
|
|
12
12
|
external?: boolean;
|
|
13
13
|
target?: '_self' | '_blank';
|
|
14
|
+
languageInsensitive?: boolean;
|
|
14
15
|
|
|
15
16
|
version?: string;
|
|
16
17
|
isDefault?: boolean;
|
|
@@ -36,6 +37,7 @@ export type ResolvedNavGroupItem = {
|
|
|
36
37
|
target?: '_self' | '_blank';
|
|
37
38
|
expanded?: string;
|
|
38
39
|
selectFirstItemOnExpand?: boolean;
|
|
40
|
+
languageInsensitive?: boolean;
|
|
39
41
|
|
|
40
42
|
version?: string;
|
|
41
43
|
isDefault?: boolean;
|
|
@@ -53,40 +55,42 @@ export type ResolvedNavItem =
|
|
|
53
55
|
| ResolvedNavLinkItem
|
|
54
56
|
| ResolvedNavGroupItem
|
|
55
57
|
| {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
type: 'separator';
|
|
59
|
+
metadata?: Record<string, unknown>;
|
|
60
|
+
label?: string;
|
|
61
|
+
labelTranslationKey?: string;
|
|
62
|
+
routeSlug?: never;
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
version?: string;
|
|
65
|
+
isDefault?: boolean;
|
|
66
|
+
versionFolderId?: string;
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
separatorLine?: boolean;
|
|
69
|
+
link?: undefined;
|
|
70
|
+
items?: ResolvedNavItem[]; // for typescript
|
|
71
|
+
sidebar?: ResolvedNavItem[]; // for typescript
|
|
72
|
+
icon?: string;
|
|
73
|
+
languageInsensitive?: boolean;
|
|
74
|
+
[REDOCLY_TEAMS_RBAC]?: Rbac;
|
|
75
|
+
}
|
|
73
76
|
| {
|
|
74
|
-
|
|
77
|
+
type: 'error';
|
|
75
78
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
version?: string;
|
|
80
|
+
isDefault?: boolean;
|
|
81
|
+
versionFolderId?: string;
|
|
82
|
+
metadata?: Record<string, unknown>;
|
|
83
|
+
routeSlug?: never;
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
label: string;
|
|
86
|
+
labelTranslationKey?: string;
|
|
87
|
+
link?: undefined;
|
|
88
|
+
items?: ResolvedNavItem[]; // for typescript
|
|
89
|
+
sidebar?: ResolvedNavItem[]; // for typescript
|
|
90
|
+
icon?: string; // for typescript
|
|
91
|
+
languageInsensitive?: boolean; // for typescript
|
|
92
|
+
[REDOCLY_TEAMS_RBAC]?: Rbac;
|
|
93
|
+
};
|
|
90
94
|
|
|
91
95
|
|
|
92
96
|
export type ResolvedNavItemWithLink = (ResolvedNavLinkItem | ResolvedNavGroupItem) & {
|
|
@@ -120,7 +124,7 @@ export interface PageData {
|
|
|
120
124
|
versions?: Version[];
|
|
121
125
|
userData: UserData;
|
|
122
126
|
}
|
|
123
|
-
export
|
|
127
|
+
export enum MenuStyle {
|
|
124
128
|
Drilldown = 'drilldown',
|
|
125
129
|
}
|
|
126
130
|
|
|
@@ -150,7 +154,7 @@ export interface LogoConfig {
|
|
|
150
154
|
link?: string;
|
|
151
155
|
favicon?: string;
|
|
152
156
|
}
|
|
153
|
-
export
|
|
157
|
+
export type Version = {
|
|
154
158
|
version: string;
|
|
155
159
|
label: string;
|
|
156
160
|
link: string;
|
|
@@ -159,20 +163,20 @@ export type Version = {
|
|
|
159
163
|
notExists?: boolean;
|
|
160
164
|
folderId: string;
|
|
161
165
|
};
|
|
162
|
-
export
|
|
166
|
+
export type VersionConfigItem = {
|
|
163
167
|
version: string;
|
|
164
168
|
name?: string;
|
|
165
169
|
};
|
|
166
|
-
export
|
|
170
|
+
export type VersionsConfigType = {
|
|
167
171
|
versions: VersionConfigItem[];
|
|
168
172
|
default?: string;
|
|
169
173
|
};
|
|
170
|
-
export
|
|
174
|
+
export type VersionedFolderConfig = {
|
|
171
175
|
versionedFiles: Map<string, Set<string>>;
|
|
172
176
|
defaultVersion?: string;
|
|
173
177
|
versions: VersionConfigItem[];
|
|
174
178
|
hasVersionsConfig?: boolean;
|
|
175
179
|
};
|
|
176
|
-
export
|
|
177
|
-
export
|
|
178
|
-
export
|
|
180
|
+
export type NavGroup = ResolvedNavItem[] | undefined | string | boolean | number;
|
|
181
|
+
export type NavGroupRecord = Record<string, NavGroup>;
|
|
182
|
+
export type ResolvedConfigLinks = NavGroup | NavGroupRecord;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { ProductConfig } from "@theme/config";
|
|
2
|
+
|
|
1
3
|
export interface OperationParameter {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
name: string | string[];
|
|
5
|
+
description: string | string[];
|
|
6
|
+
place: string;
|
|
7
|
+
path?: string[];
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export const PERMISSION_PROP_NAME = 'redocly::permission';
|
|
@@ -16,5 +18,6 @@ export interface SearchDocument {
|
|
|
16
18
|
pathName?: string | string[];
|
|
17
19
|
parameters?: OperationParameter[];
|
|
18
20
|
metadata?: Record<string, any>;
|
|
21
|
+
product?: ProductConfig;
|
|
19
22
|
[PERMISSION_PROP_NAME]?: string;
|
|
20
23
|
}
|
package/src/ui/darkColors.tsx
CHANGED
|
@@ -81,6 +81,8 @@ export const darkMode = css`
|
|
|
81
81
|
--page-403-description-text-color: #fff;
|
|
82
82
|
--checkbox-backround-color: var(--color-secondary-900);
|
|
83
83
|
--checkbox-checked-backround-color: var(--color-primary-400);
|
|
84
|
+
--select-list-item-active-background-color: #282828;
|
|
85
|
+
--dropdown-list-item-active-background-color: #282828;
|
|
84
86
|
|
|
85
87
|
background-color: var(--background-color);
|
|
86
88
|
color: var(--text-color);
|
package/src/ui/index.tsx
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { ResolvedNavLinkItem } from '../../types/portal';
|
|
3
|
-
interface NavbarDropdownProps {
|
|
4
|
-
items: ResolvedNavLinkItem[];
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function NavbarDropdown({ items, className }: NavbarDropdownProps): JSX.Element;
|
|
8
|
-
export declare const DropdownWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DropdownWrapper = exports.NavbarDropdown = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const Link_1 = require("../../mocks/Link");
|
|
10
|
-
const hooks_1 = require("../../mocks/hooks");
|
|
11
|
-
function NavbarDropdown({ items, className }) {
|
|
12
|
-
const { translate } = (0, hooks_1.useTranslate)();
|
|
13
|
-
return (react_1.default.createElement(exports.DropdownWrapper, { "data-component-name": "Navbar/NavbarDropdown", className: className }, items.map((item, index) => (react_1.default.createElement("div", { key: `${item.label}_${index}` },
|
|
14
|
-
react_1.default.createElement(Link_1.Link, { to: item.link }, translate(item.labelTranslationKey, item.label)))))));
|
|
15
|
-
}
|
|
16
|
-
exports.NavbarDropdown = NavbarDropdown;
|
|
17
|
-
exports.DropdownWrapper = styled_components_1.default.div `
|
|
18
|
-
display: none;
|
|
19
|
-
position: absolute;
|
|
20
|
-
background: var(--navbar-dropdown-background);
|
|
21
|
-
border: var(--navbar-item-border);
|
|
22
|
-
border-radius: var(--navbar-item-border-radius);
|
|
23
|
-
padding: 10px 15px;
|
|
24
|
-
width: max-content;
|
|
25
|
-
line-height: 1rem;
|
|
26
|
-
box-shadow: var(--navbar-dropdown-shadow);
|
|
27
|
-
& > div {
|
|
28
|
-
text-align: left;
|
|
29
|
-
padding: 10px 0;
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
a {
|
|
32
|
-
color: var(--navbar-text-color);
|
|
33
|
-
text-decoration: none;
|
|
34
|
-
}
|
|
35
|
-
:hover {
|
|
36
|
-
text-decoration: underline;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
//# sourceMappingURL=NavbarDropdown.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface UserProfileMenuProps {
|
|
3
|
-
setIsOpened: (isOpen: boolean) => void;
|
|
4
|
-
handleLogout: () => void;
|
|
5
|
-
hasDeveloperOnboarding: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function UserProfileMenu({ hasDeveloperOnboarding, setIsOpened, handleLogout, }: UserProfileMenuProps): JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.UserProfileMenu = void 0;
|
|
30
|
-
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
-
const Link_1 = require("../../mocks/Link");
|
|
33
|
-
const useThemeConfig_1 = require("../../hooks/useThemeConfig");
|
|
34
|
-
const hooks_1 = require("../../mocks/hooks");
|
|
35
|
-
function UserProfileMenu({ hasDeveloperOnboarding, setIsOpened, handleLogout, }) {
|
|
36
|
-
var _a;
|
|
37
|
-
const { userProfile } = (0, useThemeConfig_1.useThemeConfig)();
|
|
38
|
-
const { translate } = (0, hooks_1.useTranslate)();
|
|
39
|
-
const translationKeys = {
|
|
40
|
-
myApps: 'theme.profile.myApps',
|
|
41
|
-
logout: 'theme.profile.logout',
|
|
42
|
-
};
|
|
43
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
44
|
-
react_1.default.createElement(StyledUl, { onClick: () => setIsOpened(false) },
|
|
45
|
-
hasDeveloperOnboarding ? (react_1.default.createElement(Link_1.Link, { to: "/apps" },
|
|
46
|
-
react_1.default.createElement(StyledLi, { "data-translation-key": translationKeys.myApps }, translate(translationKeys.myApps, 'My Apps')))) : null, (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.menu) === null || _a === void 0 ? void 0 :
|
|
47
|
-
_a.map((item) => (react_1.default.createElement(Link_1.Link, { external: item.external, key: item.label, to: item.link || '' },
|
|
48
|
-
react_1.default.createElement(StyledLi, { separatorLine: item === null || item === void 0 ? void 0 : item.separatorLine }, item.label)))),
|
|
49
|
-
react_1.default.createElement(StyledLi, { onClick: () => handleLogout(), "data-translation-key": translationKeys.logout, role: "link" }, translate(translationKeys.logout, (userProfile === null || userProfile === void 0 ? void 0 : userProfile.logoutLabel) || 'Log out')))));
|
|
50
|
-
}
|
|
51
|
-
exports.UserProfileMenu = UserProfileMenu;
|
|
52
|
-
const StyledUl = styled_components_1.default.ul `
|
|
53
|
-
margin: var(--profile-menu-margin);
|
|
54
|
-
padding: var(--profile-menu-padding);
|
|
55
|
-
list-style: none;
|
|
56
|
-
background-color: var(--profile-menu-background-color);
|
|
57
|
-
min-width: 100px;
|
|
58
|
-
a {
|
|
59
|
-
text-decoration: none;
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
|
-
const StyledLi = styled_components_1.default.li `
|
|
63
|
-
cursor: pointer;
|
|
64
|
-
font-size: var(--profile-menu-item-font-size);
|
|
65
|
-
font-family: var(--profile-menu-item-font-family);
|
|
66
|
-
font-weight: var(--profile-menu-item-font-weight);
|
|
67
|
-
line-height: var(--profile-menu-item-line-height);
|
|
68
|
-
color: var(--profile-menu-item-text-color);
|
|
69
|
-
text-align: var(--profile-menu-item-text-align);
|
|
70
|
-
|
|
71
|
-
list-style: none;
|
|
72
|
-
|
|
73
|
-
padding: var(--profile-menu-item-padding-vertical) var(--profile-menu-item-padding-horizontal);
|
|
74
|
-
|
|
75
|
-
transition: background-color 0.25s ease 0s;
|
|
76
|
-
|
|
77
|
-
&:hover {
|
|
78
|
-
color: var(--profile-menu-item-hover-text-color);
|
|
79
|
-
background-color: var(--profile-menu-item-hover-background-color);
|
|
80
|
-
text-decoration: var(--profile-menu-item-hover-text-decoration);
|
|
81
|
-
}
|
|
82
|
-
&:active {
|
|
83
|
-
color: var(--profile-menu-item-active-text-color);
|
|
84
|
-
background-color: var(--profile-menu-item-active-background-color);
|
|
85
|
-
text-decoration: var(--profile-menu-item-active-text-decoration);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
${({ separatorLine }) => separatorLine &&
|
|
89
|
-
(0, styled_components_1.css) `
|
|
90
|
-
border-bottom: 1px solid var(--profile-menu-item-separator-line-color);
|
|
91
|
-
`}
|
|
92
|
-
`;
|
|
93
|
-
//# sourceMappingURL=UserProfileMenu.js.map
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { Link } from '@portal/Link';
|
|
5
|
-
import type { ResolvedNavLinkItem } from '@theme/types/portal';
|
|
6
|
-
import { useTranslate } from '@portal/hooks';
|
|
7
|
-
|
|
8
|
-
interface NavbarDropdownProps {
|
|
9
|
-
items: ResolvedNavLinkItem[];
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function NavbarDropdown({ items, className }: NavbarDropdownProps): JSX.Element {
|
|
14
|
-
const { translate } = useTranslate();
|
|
15
|
-
return (
|
|
16
|
-
<DropdownWrapper data-component-name="Navbar/NavbarDropdown" className={className}>
|
|
17
|
-
{items.map((item, index) => (
|
|
18
|
-
<div key={`${item.label}_${index}`}>
|
|
19
|
-
<Link to={item.link}>{translate(item.labelTranslationKey, item.label)}</Link>
|
|
20
|
-
</div>
|
|
21
|
-
))}
|
|
22
|
-
</DropdownWrapper>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const DropdownWrapper = styled.div`
|
|
27
|
-
display: none;
|
|
28
|
-
position: absolute;
|
|
29
|
-
background: var(--navbar-dropdown-background);
|
|
30
|
-
border: var(--navbar-item-border);
|
|
31
|
-
border-radius: var(--navbar-item-border-radius);
|
|
32
|
-
padding: 10px 15px;
|
|
33
|
-
width: max-content;
|
|
34
|
-
line-height: 1rem;
|
|
35
|
-
box-shadow: var(--navbar-dropdown-shadow);
|
|
36
|
-
& > div {
|
|
37
|
-
text-align: left;
|
|
38
|
-
padding: 10px 0;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
a {
|
|
41
|
-
color: var(--navbar-text-color);
|
|
42
|
-
text-decoration: none;
|
|
43
|
-
}
|
|
44
|
-
:hover {
|
|
45
|
-
text-decoration: underline;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { Link } from '@portal/Link';
|
|
5
|
-
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
|
6
|
-
import { useTranslate } from '@portal/hooks';
|
|
7
|
-
|
|
8
|
-
interface UserProfileMenuProps {
|
|
9
|
-
setIsOpened: (isOpen: boolean) => void;
|
|
10
|
-
handleLogout: () => void;
|
|
11
|
-
hasDeveloperOnboarding: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function UserProfileMenu({
|
|
15
|
-
hasDeveloperOnboarding,
|
|
16
|
-
setIsOpened,
|
|
17
|
-
handleLogout,
|
|
18
|
-
}: UserProfileMenuProps): JSX.Element {
|
|
19
|
-
const { userProfile } = useThemeConfig();
|
|
20
|
-
const { translate } = useTranslate();
|
|
21
|
-
const translationKeys = {
|
|
22
|
-
myApps: 'theme.profile.myApps',
|
|
23
|
-
logout: 'theme.profile.logout',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<StyledUl onClick={() => setIsOpened(false)}>
|
|
29
|
-
{hasDeveloperOnboarding ? (
|
|
30
|
-
<Link to="/apps">
|
|
31
|
-
<StyledLi data-translation-key={translationKeys.myApps}>
|
|
32
|
-
{translate(translationKeys.myApps, 'My Apps')}
|
|
33
|
-
</StyledLi>
|
|
34
|
-
</Link>
|
|
35
|
-
) : null}
|
|
36
|
-
|
|
37
|
-
{userProfile?.menu?.map((item) => (
|
|
38
|
-
<Link external={item.external} key={item.label} to={item.link || ''}>
|
|
39
|
-
<StyledLi separatorLine={item?.separatorLine}>{item.label}</StyledLi>
|
|
40
|
-
</Link>
|
|
41
|
-
))}
|
|
42
|
-
|
|
43
|
-
<StyledLi
|
|
44
|
-
onClick={() => handleLogout()}
|
|
45
|
-
data-translation-key={translationKeys.logout}
|
|
46
|
-
role="link"
|
|
47
|
-
>
|
|
48
|
-
{translate(translationKeys.logout, userProfile?.logoutLabel || 'Log out')}
|
|
49
|
-
</StyledLi>
|
|
50
|
-
</StyledUl>
|
|
51
|
-
</>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const StyledUl = styled.ul`
|
|
56
|
-
margin: var(--profile-menu-margin);
|
|
57
|
-
padding: var(--profile-menu-padding);
|
|
58
|
-
list-style: none;
|
|
59
|
-
background-color: var(--profile-menu-background-color);
|
|
60
|
-
min-width: 100px;
|
|
61
|
-
a {
|
|
62
|
-
text-decoration: none;
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
const StyledLi = styled.li<{ separatorLine?: boolean }>`
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
font-size: var(--profile-menu-item-font-size);
|
|
69
|
-
font-family: var(--profile-menu-item-font-family);
|
|
70
|
-
font-weight: var(--profile-menu-item-font-weight);
|
|
71
|
-
line-height: var(--profile-menu-item-line-height);
|
|
72
|
-
color: var(--profile-menu-item-text-color);
|
|
73
|
-
text-align: var(--profile-menu-item-text-align);
|
|
74
|
-
|
|
75
|
-
list-style: none;
|
|
76
|
-
|
|
77
|
-
padding: var(--profile-menu-item-padding-vertical) var(--profile-menu-item-padding-horizontal);
|
|
78
|
-
|
|
79
|
-
transition: background-color 0.25s ease 0s;
|
|
80
|
-
|
|
81
|
-
&:hover {
|
|
82
|
-
color: var(--profile-menu-item-hover-text-color);
|
|
83
|
-
background-color: var(--profile-menu-item-hover-background-color);
|
|
84
|
-
text-decoration: var(--profile-menu-item-hover-text-decoration);
|
|
85
|
-
}
|
|
86
|
-
&:active {
|
|
87
|
-
color: var(--profile-menu-item-active-text-color);
|
|
88
|
-
background-color: var(--profile-menu-item-active-background-color);
|
|
89
|
-
text-decoration: var(--profile-menu-item-active-text-decoration);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
${({ separatorLine }) =>
|
|
93
|
-
separatorLine &&
|
|
94
|
-
css`
|
|
95
|
-
border-bottom: 1px solid var(--profile-menu-item-separator-line-color);
|
|
96
|
-
`}
|
|
97
|
-
`;
|