@redocly/theme 0.83.0-rc.2 → 0.83.0-rc.3
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/components/Breadcrumbs/Breadcrumb.d.ts +0 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +0 -1
- package/lib/components/Buttons/EditPageButton.d.ts +0 -1
- package/lib/components/Buttons/EmailButton.d.ts +0 -1
- package/lib/components/Buttons/NewTabButton.d.ts +0 -1
- package/lib/components/Catalog/Catalog.d.ts +0 -1
- package/lib/components/Catalog/CatalogActions.d.ts +0 -1
- package/lib/components/Catalog/CatalogCard.d.ts +0 -1
- package/lib/components/Catalog/CatalogInfoBlock.d.ts +0 -1
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +0 -1
- package/lib/components/ColorModeSwitcher/ColorModeIcon.d.ts +0 -1
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.d.ts +0 -1
- package/lib/components/Dropdown/DropdownMenu.js +21 -28
- package/lib/components/Dropdown/DropdownMenuItem.js +2 -0
- package/lib/components/Feedback/Comment.d.ts +0 -1
- package/lib/components/Feedback/Mood.d.ts +0 -1
- package/lib/components/Feedback/Rating.d.ts +0 -1
- package/lib/components/Feedback/Reasons.d.ts +0 -1
- package/lib/components/Feedback/ReportDialog.d.ts +0 -1
- package/lib/components/Feedback/Scale.d.ts +0 -1
- package/lib/components/Feedback/Sentiment.d.ts +0 -1
- package/lib/components/Feedback/Stars.d.ts +0 -1
- package/lib/components/Filter/Filter.d.ts +0 -1
- package/lib/components/Filter/FilterCheckboxes.d.ts +0 -1
- package/lib/components/Filter/FilterContent.d.ts +0 -1
- package/lib/components/Filter/FilterDateRange.d.ts +0 -1
- package/lib/components/Filter/FilterInput.d.ts +0 -1
- package/lib/components/Filter/FilterPopover.d.ts +0 -1
- package/lib/components/Filter/FilterSelect.d.ts +0 -1
- package/lib/components/Footer/Footer.d.ts +0 -1
- package/lib/components/Footer/FooterColumn.d.ts +0 -1
- package/lib/components/Footer/FooterCopyright.d.ts +0 -1
- package/lib/components/Footer/FooterItem.d.ts +0 -1
- package/lib/components/Image/Image.d.ts +0 -1
- package/lib/components/LanguagePicker/LanguagePicker.d.ts +0 -1
- package/lib/components/LastUpdated/LastUpdated.d.ts +0 -1
- package/lib/components/Loading/Loading.d.ts +0 -1
- package/lib/components/Logo/Logo.d.ts +0 -1
- package/lib/components/Menu/Menu.d.ts +0 -1
- package/lib/components/Menu/MenuItem.js +12 -3
- package/lib/components/Menu/MenuMobile.d.ts +0 -1
- package/lib/components/Navbar/Navbar.d.ts +0 -1
- package/lib/components/Navbar/Navbar.js +1 -9
- package/lib/components/Navbar/NavbarItem.d.ts +0 -1
- package/lib/components/Navbar/NavbarMenu.d.ts +0 -1
- package/lib/components/PageNavigation/NextButton.d.ts +0 -1
- package/lib/components/PageNavigation/PageNavigation.d.ts +0 -1
- package/lib/components/PageNavigation/PreviousButton.d.ts +0 -1
- package/lib/components/Product/Product.d.ts +0 -1
- package/lib/components/Product/ProductPicker.d.ts +0 -1
- package/lib/components/Search/Search.d.ts +0 -1
- package/lib/components/Search/SearchDialog.d.ts +0 -1
- package/lib/components/Search/SearchHighlight.d.ts +0 -1
- package/lib/components/Search/SearchItem.d.ts +0 -1
- package/lib/components/Search/SearchRecent.d.ts +0 -1
- package/lib/components/Search/SearchShortcut.d.ts +0 -1
- package/lib/components/Search/SearchSuggestedPages.d.ts +0 -1
- package/lib/components/Search/SearchTrigger.d.ts +0 -1
- package/lib/components/SidebarActions/ChangeViewButton.d.ts +0 -1
- package/lib/components/SidebarLogo/SidebarLogo.d.ts +0 -1
- package/lib/components/TableOfContent/TableOfContent.d.ts +0 -1
- package/lib/components/UserMenu/LoginButton.d.ts +0 -1
- package/lib/components/UserMenu/LogoutMenuItem.d.ts +0 -1
- package/lib/components/UserMenu/UserAvatar.d.ts +0 -1
- package/lib/components/UserMenu/UserInfoMenuItem.d.ts +0 -1
- package/lib/components/UserMenu/UserMenu.js +13 -5
- package/lib/components/UserMenu/UserMenuMobile.d.ts +0 -1
- package/lib/components/UserMenu/UserMenuMobile.js +2 -1
- package/lib/core/hooks/menu/use-nested-menu.d.ts +0 -1
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +0 -1
- package/lib/core/types/hooks.d.ts +0 -1
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/layouts/Forbidden.d.ts +0 -1
- package/lib/layouts/NotFound.d.ts +0 -1
- package/lib/layouts/OIDCForbidden.d.ts +0 -1
- package/lib/markdoc/components/Mermaid/Mermaid.d.ts +0 -1
- package/package.json +4 -4
- package/src/components/Dropdown/DropdownMenu.tsx +21 -28
- package/src/components/Dropdown/DropdownMenuItem.tsx +2 -0
- package/src/components/Menu/MenuItem.tsx +14 -2
- package/src/components/Navbar/Navbar.tsx +1 -13
- package/src/components/UserMenu/UserMenu.tsx +24 -14
- package/src/components/UserMenu/UserMenuMobile.tsx +3 -2
- package/src/core/types/sidebar.ts +1 -0
|
@@ -19,35 +19,28 @@ function DropdownMenu(props) {
|
|
|
19
19
|
}
|
|
20
20
|
exports.DropdownMenu = DropdownMenu;
|
|
21
21
|
const DropdownMenuWrapper = styled_components_1.default.ul `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
color: var(--dropdown-menu-text-color);
|
|
22
|
+
font-size: var(--dropdown-menu-font-size);
|
|
23
|
+
font-weight: var(--dropdown-menu-font-weight);
|
|
24
|
+
line-height: var(--dropdown-menu-line-height);
|
|
25
|
+
color: var(--dropdown-menu-text-color);
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
margin: 0;
|
|
28
|
+
min-width: var(--dropdown-menu-min-width);
|
|
29
|
+
max-width: var(--dropdown-menu-max-width);
|
|
30
|
+
max-height: var(--dropdown-menu-max-height);
|
|
31
|
+
padding: var(--dropdown-menu-padding);
|
|
32
|
+
background-color: var(--dropdown-menu-bg-color);
|
|
33
|
+
border-radius: var(--dropdown-menu-border-radius);
|
|
34
|
+
box-shadow: var(--dropdown-menu-box-shadow);
|
|
35
|
+
border: 1px solid var(--dropdown-menu-border-color);
|
|
36
|
+
list-style-type: none;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
overflow-x: hidden;
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
z-index: var(--z-index-surface);
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
a {
|
|
48
|
-
text-decoration: none;
|
|
49
|
-
color: var(--dropdown-menu-text-color);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--dropdown-menu-item-gap);
|
|
52
45
|
`;
|
|
53
46
|
//# sourceMappingURL=DropdownMenu.js.map
|
|
@@ -93,6 +93,8 @@ const DropdownMenuItemWrapper = styled_components_1.default.li `
|
|
|
93
93
|
background-color: var(--dropdown-menu-item-bg-color);
|
|
94
94
|
color: var(--dropdown-menu-item-color);
|
|
95
95
|
|
|
96
|
+
text-decoration: none;
|
|
97
|
+
|
|
96
98
|
&:hover {
|
|
97
99
|
background-color: var(--dropdown-menu-item-bg-color-hover);
|
|
98
100
|
color: var(--dropdown-menu-item-color-hover);
|
|
@@ -61,7 +61,7 @@ function MenuItem(props) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
const chevron = hasChevron ? (isExpanded ? (react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" })) : (react_1.default.createElement(ChevronRightIcon_1.ChevronRightIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" }))) : null;
|
|
64
|
-
const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, depth: depth, withChevron: hasChevron, onClick: handleOnClick, ref: labelRef, role: item.link ? 'none' : 'link' },
|
|
64
|
+
const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, deprecated: item.deprecated, depth: depth, withChevron: hasChevron, onClick: handleOnClick, ref: labelRef, role: item.link ? 'none' : 'link' },
|
|
65
65
|
chevron,
|
|
66
66
|
item.icon ? react_1.default.createElement(MenuItemIcon, { src: item.icon }) : null,
|
|
67
67
|
react_1.default.createElement(MenuItemLabelTextWrapper, null,
|
|
@@ -161,9 +161,9 @@ const MenuItemLabelWrapper = styled_components_1.default.li `
|
|
|
161
161
|
${depth ? 'var(--menu-item-nested-offset) * ' + depth : '0px'}
|
|
162
162
|
)`};
|
|
163
163
|
|
|
164
|
-
${({ active }) => active &&
|
|
164
|
+
${({ active, deprecated }) => active &&
|
|
165
165
|
(0, styled_components_1.css) `
|
|
166
|
-
color: var(--menu-item-color-active);
|
|
166
|
+
color: ${deprecated ? '(--menu-content-color-disabled)' : 'var(--menu-item-color-active)'};
|
|
167
167
|
background-color: var(--menu-item-bg-color-active);
|
|
168
168
|
|
|
169
169
|
&:hover {
|
|
@@ -171,6 +171,15 @@ const MenuItemLabelWrapper = styled_components_1.default.li `
|
|
|
171
171
|
}
|
|
172
172
|
`};
|
|
173
173
|
|
|
174
|
+
${({ deprecated }) => deprecated &&
|
|
175
|
+
(0, styled_components_1.css) `
|
|
176
|
+
color: var(--menu-content-color-disabled);
|
|
177
|
+
|
|
178
|
+
&:hover {
|
|
179
|
+
color: var(--menu-content-color-disabled);
|
|
180
|
+
}
|
|
181
|
+
`};
|
|
182
|
+
|
|
174
183
|
&:hover {
|
|
175
184
|
color: var(--menu-item-color-hover);
|
|
176
185
|
background: var(--menu-item-bg-color-hover);
|
|
@@ -51,8 +51,7 @@ function Navbar({ className }) {
|
|
|
51
51
|
openMobileMenu();
|
|
52
52
|
telemetry.send('mobile_menu_button_open_clicked', {});
|
|
53
53
|
}, icon: isOpen ? react_1.default.createElement(CloseIcon_1.CloseIcon, null) : react_1.default.createElement(MenuIcon_1.MenuIcon, null) }),
|
|
54
|
-
hideUserMenu ? null :
|
|
55
|
-
react_1.default.createElement(UserMenu_1.UserMenu, null))))));
|
|
54
|
+
hideUserMenu ? null : react_1.default.createElement(UserMenu_1.UserMenu, null))));
|
|
56
55
|
}
|
|
57
56
|
exports.Navbar = Navbar;
|
|
58
57
|
const NavbarWrapper = styled_components_1.default.nav `
|
|
@@ -92,13 +91,6 @@ const NavbarRow = styled_components_1.default.div `
|
|
|
92
91
|
gap: var(--navbar-menu-items-gap);
|
|
93
92
|
max-width: var(--navbar-container-max-width);
|
|
94
93
|
`;
|
|
95
|
-
const UserMenuWrapper = styled_components_1.default.div `
|
|
96
|
-
display: none;
|
|
97
|
-
|
|
98
|
-
@media screen and (min-width: ${utils_1.breakpoints.medium}) {
|
|
99
|
-
display: block;
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
102
94
|
const MobileMenuButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
103
95
|
margin-left: 0px !important;
|
|
104
96
|
|
|
@@ -15,13 +15,14 @@ const UserAvatar_1 = require("../../components/UserMenu/UserAvatar");
|
|
|
15
15
|
const UserInfoMenuItem_1 = require("../../components/UserMenu/UserInfoMenuItem");
|
|
16
16
|
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
17
17
|
const LogoutMenuItem_1 = require("../../components/UserMenu/LogoutMenuItem");
|
|
18
|
+
const core_1 = require("../../core");
|
|
18
19
|
function UserMenu({ className }) {
|
|
19
20
|
const { userMenu } = (0, hooks_1.useThemeConfig)();
|
|
20
21
|
const { useTranslate, useUserMenu } = (0, hooks_1.useThemeHooks)();
|
|
21
22
|
const { userData, hasDeveloperOnboarding, loginUrl } = useUserMenu();
|
|
22
23
|
const { translate } = useTranslate();
|
|
23
24
|
if (!(userData === null || userData === void 0 ? void 0 : userData.isAuthenticated)) {
|
|
24
|
-
if (loginUrl) {
|
|
25
|
+
if (loginUrl && !(userMenu === null || userMenu === void 0 ? void 0 : userMenu.hideLoginButton)) {
|
|
25
26
|
return react_1.default.createElement(LoginButton_1.LoginButton, { href: loginUrl, "data-testid": "login-btn" });
|
|
26
27
|
}
|
|
27
28
|
else {
|
|
@@ -42,11 +43,19 @@ function UserMenu({ className }) {
|
|
|
42
43
|
...customItems,
|
|
43
44
|
react_1.default.createElement(LogoutMenuItem_1.LogoutMenuItem, { key: "logout" }),
|
|
44
45
|
];
|
|
45
|
-
return (react_1.default.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
return (react_1.default.createElement(UserMenuWrapper, { "data-component-name": "UserMenu/UserMenu" },
|
|
47
|
+
react_1.default.createElement(StyledDropdown, { className: className, alignment: "end", "data-component-name": "UserMenu/UserMenu", trigger: react_1.default.createElement(UserMenuTrigger, { role: "button" },
|
|
48
|
+
react_1.default.createElement(UserAvatar_1.UserAvatar, { picture: userData.picture })) },
|
|
49
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, items))));
|
|
48
50
|
}
|
|
49
51
|
exports.UserMenu = UserMenu;
|
|
52
|
+
const UserMenuWrapper = styled_components_1.default.div `
|
|
53
|
+
display: none;
|
|
54
|
+
|
|
55
|
+
@media screen and (min-width: ${core_1.breakpoints.medium}) {
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
50
59
|
const UserMenuTrigger = styled_components_1.default.div.attrs(() => ({
|
|
51
60
|
'data-testid': 'user-menu-button',
|
|
52
61
|
})) `
|
|
@@ -59,7 +68,6 @@ const UserMenuTrigger = styled_components_1.default.div.attrs(() => ({
|
|
|
59
68
|
const StyledDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown).attrs(() => ({
|
|
60
69
|
dataAttributes: {
|
|
61
70
|
'data-testid': 'user-menu-dropdown',
|
|
62
|
-
'data-component-name': 'UserMenu/UserMenu',
|
|
63
71
|
},
|
|
64
72
|
})) `
|
|
65
73
|
--dropdown-menu-font-size: var(--user-menu-dropdown-font-size);
|
|
@@ -13,8 +13,9 @@ const LoginButton_1 = require("../../components/UserMenu/LoginButton");
|
|
|
13
13
|
function UserMenuMobile({ className }) {
|
|
14
14
|
const { useUserMenu } = (0, hooks_1.useThemeHooks)();
|
|
15
15
|
const { userData, loginUrl } = useUserMenu();
|
|
16
|
+
const { userMenu: userMenuSettings } = (0, hooks_1.useThemeConfig)();
|
|
16
17
|
if (!(userData === null || userData === void 0 ? void 0 : userData.isAuthenticated)) {
|
|
17
|
-
if (loginUrl) {
|
|
18
|
+
if (loginUrl && !(userMenuSettings === null || userMenuSettings === void 0 ? void 0 : userMenuSettings.hideLoginButton)) {
|
|
18
19
|
return (react_1.default.createElement(UserMenuMobileWrapper, { "data-component-name": "UserMenu/UserMenuMobile", className: className },
|
|
19
20
|
react_1.default.createElement(UserMenuMobileLoginButton, { href: loginUrl })));
|
|
20
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.83.0-rc.
|
|
3
|
+
"version": "0.83.0-rc.3",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@storybook/react": "7.6.19",
|
|
47
47
|
"@storybook/react-webpack5": "7.6.19",
|
|
48
48
|
"@storybook/testing-library": "0.2.2",
|
|
49
|
-
"@storybook/theming": "
|
|
49
|
+
"@storybook/theming": "8.0.0",
|
|
50
50
|
"@testing-library/jest-dom": "6.1.5",
|
|
51
51
|
"@testing-library/react": "14.1.2",
|
|
52
52
|
"@testing-library/user-event": "14.5.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"react-router-dom": "6.21.1",
|
|
77
77
|
"rimraf": "5.0.5",
|
|
78
78
|
"storybook": "7.6.19",
|
|
79
|
-
"storybook-addon-pseudo-states": "
|
|
79
|
+
"storybook-addon-pseudo-states": "3.1.1",
|
|
80
80
|
"storybook-design-token": "3.1.0",
|
|
81
81
|
"styled-components": "5.3.11",
|
|
82
82
|
"styled-system": "5.1.5",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"timeago.js": "^4.0.2",
|
|
99
99
|
"i18next": "^22.4.12",
|
|
100
100
|
"nprogress": "^0.2.0",
|
|
101
|
-
"@redocly/config": "0.83.0-rc.
|
|
101
|
+
"@redocly/config": "0.83.0-rc.3"
|
|
102
102
|
},
|
|
103
103
|
"scripts": {
|
|
104
104
|
"start": "npm-run-all --parallel storybook storybook:tokens:watch",
|
|
@@ -42,34 +42,27 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const DropdownMenuWrapper = styled.ul`
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
color: var(--dropdown-menu-text-color);
|
|
45
|
+
font-size: var(--dropdown-menu-font-size);
|
|
46
|
+
font-weight: var(--dropdown-menu-font-weight);
|
|
47
|
+
line-height: var(--dropdown-menu-line-height);
|
|
48
|
+
color: var(--dropdown-menu-text-color);
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
margin: 0;
|
|
51
|
+
min-width: var(--dropdown-menu-min-width);
|
|
52
|
+
max-width: var(--dropdown-menu-max-width);
|
|
53
|
+
max-height: var(--dropdown-menu-max-height);
|
|
54
|
+
padding: var(--dropdown-menu-padding);
|
|
55
|
+
background-color: var(--dropdown-menu-bg-color);
|
|
56
|
+
border-radius: var(--dropdown-menu-border-radius);
|
|
57
|
+
box-shadow: var(--dropdown-menu-box-shadow);
|
|
58
|
+
border: 1px solid var(--dropdown-menu-border-color);
|
|
59
|
+
list-style-type: none;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
overflow-x: hidden;
|
|
62
|
+
overflow-y: auto;
|
|
63
|
+
z-index: var(--z-index-surface);
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
a {
|
|
71
|
-
text-decoration: none;
|
|
72
|
-
color: var(--dropdown-menu-text-color);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
gap: var(--dropdown-menu-item-gap);
|
|
75
68
|
`;
|
|
@@ -133,6 +133,8 @@ const DropdownMenuItemWrapper = styled.li<{
|
|
|
133
133
|
background-color: var(--dropdown-menu-item-bg-color);
|
|
134
134
|
color: var(--dropdown-menu-item-color);
|
|
135
135
|
|
|
136
|
+
text-decoration: none;
|
|
137
|
+
|
|
136
138
|
&:hover {
|
|
137
139
|
background-color: var(--dropdown-menu-item-bg-color-hover);
|
|
138
140
|
color: var(--dropdown-menu-item-color-hover);
|
|
@@ -58,6 +58,7 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
|
|
|
58
58
|
const label = item.label && (
|
|
59
59
|
<MenuItemLabelWrapper
|
|
60
60
|
active={item.active}
|
|
61
|
+
deprecated={item.deprecated}
|
|
61
62
|
depth={depth}
|
|
62
63
|
withChevron={hasChevron}
|
|
63
64
|
onClick={handleOnClick}
|
|
@@ -207,6 +208,7 @@ const MenuItemLabelWrapper = styled.li<{
|
|
|
207
208
|
active?: boolean;
|
|
208
209
|
depth?: number;
|
|
209
210
|
withChevron?: boolean;
|
|
211
|
+
deprecated?: boolean;
|
|
210
212
|
}>`
|
|
211
213
|
display: flex;
|
|
212
214
|
position: relative;
|
|
@@ -227,10 +229,10 @@ const MenuItemLabelWrapper = styled.li<{
|
|
|
227
229
|
${depth ? 'var(--menu-item-nested-offset) * ' + depth : '0px'}
|
|
228
230
|
)`};
|
|
229
231
|
|
|
230
|
-
${({ active }) =>
|
|
232
|
+
${({ active, deprecated }) =>
|
|
231
233
|
active &&
|
|
232
234
|
css`
|
|
233
|
-
color: var(--menu-item-color-active);
|
|
235
|
+
color: ${deprecated ? '(--menu-content-color-disabled)' : 'var(--menu-item-color-active)'};
|
|
234
236
|
background-color: var(--menu-item-bg-color-active);
|
|
235
237
|
|
|
236
238
|
&:hover {
|
|
@@ -238,6 +240,16 @@ const MenuItemLabelWrapper = styled.li<{
|
|
|
238
240
|
}
|
|
239
241
|
`};
|
|
240
242
|
|
|
243
|
+
${({ deprecated }) =>
|
|
244
|
+
deprecated &&
|
|
245
|
+
css`
|
|
246
|
+
color: var(--menu-content-color-disabled);
|
|
247
|
+
|
|
248
|
+
&:hover {
|
|
249
|
+
color: var(--menu-content-color-disabled);
|
|
250
|
+
}
|
|
251
|
+
`};
|
|
252
|
+
|
|
241
253
|
&:hover {
|
|
242
254
|
color: var(--menu-item-color-hover);
|
|
243
255
|
background: var(--menu-item-bg-color-hover);
|
|
@@ -66,11 +66,7 @@ export function Navbar({ className }: NavbarProps): JSX.Element | null {
|
|
|
66
66
|
}
|
|
67
67
|
icon={isOpen ? <CloseIcon /> : <MenuIcon />}
|
|
68
68
|
/>
|
|
69
|
-
{hideUserMenu ? null :
|
|
70
|
-
<UserMenuWrapper>
|
|
71
|
-
<UserMenu />
|
|
72
|
-
</UserMenuWrapper>
|
|
73
|
-
)}
|
|
69
|
+
{hideUserMenu ? null : <UserMenu />}
|
|
74
70
|
</NavbarRow>
|
|
75
71
|
</NavbarWrapper>
|
|
76
72
|
);
|
|
@@ -115,14 +111,6 @@ const NavbarRow = styled.div`
|
|
|
115
111
|
max-width: var(--navbar-container-max-width);
|
|
116
112
|
`;
|
|
117
113
|
|
|
118
|
-
const UserMenuWrapper = styled.div`
|
|
119
|
-
display: none;
|
|
120
|
-
|
|
121
|
-
@media screen and (min-width: ${breakpoints.medium}) {
|
|
122
|
-
display: block;
|
|
123
|
-
}
|
|
124
|
-
`;
|
|
125
|
-
|
|
126
114
|
const MobileMenuButton = styled(Button)`
|
|
127
115
|
margin-left: 0px !important;
|
|
128
116
|
|
|
@@ -12,6 +12,7 @@ import { UserAvatar } from '@redocly/theme/components/UserMenu/UserAvatar';
|
|
|
12
12
|
import { UserInfoMenuItem } from '@redocly/theme/components/UserMenu/UserInfoMenuItem';
|
|
13
13
|
import { Dropdown } from '@redocly/theme/components/Dropdown/Dropdown';
|
|
14
14
|
import { LogoutMenuItem } from '@redocly/theme/components/UserMenu/LogoutMenuItem';
|
|
15
|
+
import { breakpoints } from '@redocly/theme/core';
|
|
15
16
|
|
|
16
17
|
export type UserMenuProps = {
|
|
17
18
|
className?: string;
|
|
@@ -28,7 +29,7 @@ export function UserMenu({ className }: UserMenuProps) {
|
|
|
28
29
|
const { translate } = useTranslate();
|
|
29
30
|
|
|
30
31
|
if (!userData?.isAuthenticated) {
|
|
31
|
-
if (loginUrl) {
|
|
32
|
+
if (loginUrl && !userMenu?.hideLoginButton) {
|
|
32
33
|
return <LoginButton href={loginUrl} data-testid="login-btn" />;
|
|
33
34
|
} else {
|
|
34
35
|
return null;
|
|
@@ -70,21 +71,31 @@ export function UserMenu({ className }: UserMenuProps) {
|
|
|
70
71
|
];
|
|
71
72
|
|
|
72
73
|
return (
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
<UserMenuWrapper data-component-name="UserMenu/UserMenu">
|
|
75
|
+
<StyledDropdown
|
|
76
|
+
className={className}
|
|
77
|
+
alignment="end"
|
|
78
|
+
data-component-name="UserMenu/UserMenu"
|
|
79
|
+
trigger={
|
|
80
|
+
<UserMenuTrigger role="button">
|
|
81
|
+
<UserAvatar picture={userData.picture} />
|
|
82
|
+
</UserMenuTrigger>
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
<DropdownMenu>{items}</DropdownMenu>
|
|
86
|
+
</StyledDropdown>
|
|
87
|
+
</UserMenuWrapper>
|
|
85
88
|
);
|
|
86
89
|
}
|
|
87
90
|
|
|
91
|
+
const UserMenuWrapper = styled.div`
|
|
92
|
+
display: none;
|
|
93
|
+
|
|
94
|
+
@media screen and (min-width: ${breakpoints.medium}) {
|
|
95
|
+
display: block;
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
|
|
88
99
|
const UserMenuTrigger = styled.div.attrs(() => ({
|
|
89
100
|
'data-testid': 'user-menu-button',
|
|
90
101
|
}))`
|
|
@@ -98,7 +109,6 @@ const UserMenuTrigger = styled.div.attrs(() => ({
|
|
|
98
109
|
const StyledDropdown = styled(Dropdown).attrs(() => ({
|
|
99
110
|
dataAttributes: {
|
|
100
111
|
'data-testid': 'user-menu-dropdown',
|
|
101
|
-
'data-component-name': 'UserMenu/UserMenu',
|
|
102
112
|
},
|
|
103
113
|
}))`
|
|
104
114
|
--dropdown-menu-font-size: var(--user-menu-dropdown-font-size);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
4
|
+
import { useThemeConfig, useThemeHooks } from '@redocly/theme/core/hooks';
|
|
5
5
|
import { UserAvatar } from '@redocly/theme/components/UserMenu/UserAvatar';
|
|
6
6
|
import { LogoutMenuItem } from '@redocly/theme/components/UserMenu/LogoutMenuItem';
|
|
7
7
|
import { LoginButton } from '@redocly/theme/components/UserMenu/LoginButton';
|
|
@@ -13,9 +13,10 @@ export type UserMenuMobileProps = {
|
|
|
13
13
|
export function UserMenuMobile({ className }: UserMenuMobileProps): JSX.Element | null {
|
|
14
14
|
const { useUserMenu } = useThemeHooks();
|
|
15
15
|
const { userData, loginUrl } = useUserMenu();
|
|
16
|
+
const { userMenu: userMenuSettings } = useThemeConfig();
|
|
16
17
|
|
|
17
18
|
if (!userData?.isAuthenticated) {
|
|
18
|
-
if (loginUrl) {
|
|
19
|
+
if (loginUrl && !userMenuSettings?.hideLoginButton) {
|
|
19
20
|
return (
|
|
20
21
|
<UserMenuMobileWrapper data-component-name="UserMenu/UserMenuMobile" className={className}>
|
|
21
22
|
<UserMenuMobileLoginButton href={loginUrl} />
|
|
@@ -49,6 +49,7 @@ export type ItemState = Omit<SidebarNavItem, 'items'> & {
|
|
|
49
49
|
menuStyle?: MenuStyle;
|
|
50
50
|
languageInsensitive?: boolean;
|
|
51
51
|
modified?: boolean; //item from openapi-docs sidebar
|
|
52
|
+
deprecated?: boolean; //item from openapi-docs sidebar
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
export type DrilldownMenuItemDetails = {
|