@redocly/theme 0.15.0 → 0.16.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/lib/I18n/LanguagePicker.js +2 -1
- package/lib/components/Breadcrumbs/Breadcrumb.js +0 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +6 -0
- package/lib/components/Cards/Card.d.ts +1 -0
- package/lib/components/Cards/Card.js +1 -1
- package/lib/components/Cards/CardsBlock.d.ts +1 -3
- package/lib/components/Cards/CardsBlock.js +2 -1
- package/lib/components/Catalog/Catalog.js +1 -1
- package/lib/components/CodeBlock/CodeBlock.d.ts +1 -3
- package/lib/components/CodeBlock/CodeBlock.js +2 -1
- package/lib/components/CodeSample/CodeSample.d.ts +2 -1
- package/lib/components/CodeSample/CodeSample.js +3 -2
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.d.ts +5 -1
- package/lib/components/ColorModeSwitcher/ColorModeSwitcher.js +3 -2
- package/lib/components/Feedback/Comment.d.ts +1 -1
- package/lib/components/Feedback/Comment.js +3 -3
- package/lib/components/Feedback/Rating.d.ts +1 -1
- package/lib/components/Feedback/Rating.js +2 -2
- package/lib/components/Feedback/Reasons.d.ts +1 -1
- package/lib/components/Feedback/Reasons.js +2 -2
- package/lib/components/Feedback/ReportDialog.js +1 -1
- package/lib/components/Feedback/Sentiment.d.ts +1 -1
- package/lib/components/Feedback/Sentiment.js +2 -2
- package/lib/components/Feedback/types.d.ts +5 -0
- package/lib/components/Footer/CustomFooter.d.ts +2 -1
- package/lib/components/Footer/CustomFooter.js +2 -2
- package/lib/components/Footer/CustomFooterNavItem.d.ts +2 -1
- package/lib/components/Footer/CustomFooterNavItem.js +2 -2
- package/lib/components/Footer/Footer.d.ts +2 -1
- package/lib/components/Footer/Footer.js +2 -2
- package/lib/components/Footer/FooterColumn.d.ts +2 -1
- package/lib/components/Footer/FooterColumn.js +2 -2
- package/lib/components/Footer/FooterColumns.d.ts +2 -1
- package/lib/components/Footer/FooterColumns.js +2 -2
- package/lib/components/Footer/FooterCopyright.d.ts +2 -1
- package/lib/components/Footer/FooterCopyright.js +2 -2
- package/lib/components/JsonViewer/JsonViewer.d.ts +1 -3
- package/lib/components/LastUpdated/LastUpdated.d.ts +1 -0
- package/lib/components/LastUpdated/LastUpdated.js +1 -1
- package/lib/components/Markdown/ContainerWrapper.d.ts +1 -3
- package/lib/components/Markdown/ContainerWrapper.js +5 -4
- package/lib/components/Markdown/Heading.d.ts +2 -1
- package/lib/components/Markdown/Heading.js +2 -2
- package/lib/components/Markdown/MarkdownLayout.d.ts +2 -1
- package/lib/components/Markdown/MarkdownLayout.js +2 -2
- package/lib/components/Markdown/MarkdownWrapper.d.ts +1 -3
- package/lib/components/Markdown/MarkdownWrapper.js +11 -5
- package/lib/components/Markdown/Mermaid.d.ts +2 -1
- package/lib/components/Markdown/Mermaid.js +3 -2
- package/lib/components/Markdown/PageWrapper.d.ts +1 -3
- package/lib/components/Markdown/PageWrapper.js +2 -1
- package/lib/components/Markdown/Sup.d.ts +3 -1
- package/lib/components/Markdown/Sup.js +2 -2
- package/lib/components/Menu/Menu.d.ts +3 -1
- package/lib/components/Menu/Menu.js +6 -4
- package/lib/components/Menu/MenuContainer.d.ts +1 -0
- package/lib/components/Menu/MenuContainer.js +2 -1
- package/lib/components/Menu/MenuGroup.d.ts +2 -1
- package/lib/components/Menu/MenuGroup.js +3 -3
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +19 -3
- package/lib/components/Menu/MenuItemLabel.d.ts +1 -3
- package/lib/components/Menu/MenuItemLabel.js +18 -9
- package/lib/components/Menu/MenuItemSwitch.js +4 -2
- package/lib/components/Menu/MenuLink.d.ts +1 -3
- package/lib/components/Menu/MenuLink.js +2 -1
- package/lib/components/Menu/MenuLinkItem.d.ts +1 -1
- package/lib/components/Menu/MenuLinkItem.js +2 -2
- package/lib/components/Menu/MobileMenu.d.ts +11 -0
- package/lib/components/Menu/MobileMenu.js +179 -0
- package/lib/components/Menu/MobileMenuGroup.d.ts +9 -0
- package/lib/components/Menu/MobileMenuGroup.js +53 -0
- package/lib/components/Menu/index.d.ts +1 -0
- package/lib/components/Menu/index.js +1 -0
- package/lib/components/Navbar/BurgerButton.d.ts +5 -0
- package/lib/components/Navbar/BurgerButton.js +29 -0
- package/lib/components/Navbar/MobileUserProfile.d.ts +2 -0
- package/lib/components/Navbar/MobileUserProfile.js +78 -0
- package/lib/components/Navbar/Navbar.d.ts +1 -0
- package/lib/components/Navbar/Navbar.js +29 -9
- package/lib/components/Navbar/NavbarDropdown.d.ts +2 -1
- package/lib/components/Navbar/NavbarDropdown.js +2 -2
- package/lib/components/Navbar/NavbarMenu.d.ts +2 -1
- package/lib/components/Navbar/NavbarMenu.js +2 -2
- package/lib/components/NavbarLogo/NavbarLogo.d.ts +2 -1
- package/lib/components/NavbarLogo/NavbarLogo.js +2 -2
- package/lib/components/OpenApiDocs/DevOnboardingTryItSecurity.d.ts +1 -1
- package/lib/components/OpenApiDocs/DevOnboardingTryItSecurity.js +1 -1
- package/lib/components/PageNavigation/NextButton.d.ts +2 -1
- package/lib/components/PageNavigation/NextButton.js +2 -2
- package/lib/components/PageNavigation/PageNavigation.d.ts +2 -1
- package/lib/components/PageNavigation/PageNavigation.js +2 -2
- package/lib/components/PageNavigation/PreviousButton.d.ts +2 -1
- package/lib/components/PageNavigation/PreviousButton.js +2 -2
- package/lib/components/Panel/PanelBody.d.ts +1 -3
- package/lib/components/Panel/PanelBody.js +2 -1
- package/lib/components/Panel/PanelHeader.d.ts +1 -3
- package/lib/components/Panel/PanelHeader.js +2 -1
- package/lib/components/Panel/PanelHeaderTitle.d.ts +1 -3
- package/lib/components/Panel/PanelHeaderTitle.js +2 -1
- package/lib/components/Profile/Profile.d.ts +6 -0
- package/lib/components/Profile/Profile.js +7 -7
- package/lib/components/Profile/types.d.ts +1 -0
- package/lib/components/SamplesPanelControls/SamplesPanelControls.d.ts +2 -6
- package/lib/components/SamplesPanelControls/SamplesPanelControls.js +2 -1
- package/lib/components/Search/CancelSearch.d.ts +2 -1
- package/lib/components/Search/CancelSearch.js +2 -2
- package/lib/components/Search/ClearIcon.d.ts +1 -3
- package/lib/components/Search/ClearIcon.js +2 -1
- package/lib/components/Search/ClockBackwardsIcon.d.ts +1 -4
- package/lib/components/Search/Input.d.ts +1 -3
- package/lib/components/Search/Input.js +2 -1
- package/lib/components/Search/InputWrapper.d.ts +2 -1
- package/lib/components/Search/InputWrapper.js +2 -2
- package/lib/components/Search/MobileSearchTrigger.d.ts +2 -1
- package/lib/components/Search/MobileSearchTrigger.js +6 -5
- package/lib/components/Search/Popover.d.ts +1 -3
- package/lib/components/Search/Popover.js +3 -2
- package/lib/components/Search/RecentSearches.d.ts +2 -1
- package/lib/components/Search/RecentSearches.js +3 -3
- package/lib/components/Search/Search.d.ts +3 -1
- package/lib/components/Search/Search.js +2 -2
- package/lib/components/Search/SearchDialog.d.ts +2 -1
- package/lib/components/Search/SearchDialog.js +4 -3
- package/lib/components/Search/SearchIcon.d.ts +1 -3
- package/lib/components/Search/SearchIcon.js +2 -1
- package/lib/components/Search/SearchItem.d.ts +2 -1
- package/lib/components/Search/SearchItem.js +3 -3
- package/lib/components/Search/SearchTrigger.d.ts +2 -1
- package/lib/components/Search/SearchTrigger.js +2 -2
- package/lib/components/Search/Shortcut.d.ts +2 -1
- package/lib/components/Search/Shortcut.js +2 -2
- package/lib/components/Search/ShortcutKey.d.ts +1 -0
- package/lib/components/Search/ShortcutKey.js +1 -1
- package/lib/components/Search/SidebarSearch.d.ts +1 -3
- package/lib/components/Search/SidebarSearch.js +2 -1
- package/lib/components/Search/SuggestedPages.d.ts +3 -1
- package/lib/components/Search/SuggestedPages.js +2 -2
- package/lib/components/Separator/Separator.d.ts +1 -1
- package/lib/components/Separator/Separator.js +2 -2
- package/lib/components/Separator/SeparatorItem.d.ts +1 -5
- package/lib/components/Separator/SeparatorItem.js +7 -2
- package/lib/components/Separator/SeparatorLine.d.ts +1 -3
- package/lib/components/Separator/SeparatorLine.js +2 -1
- package/lib/components/Sidebar/ApiCallItem.d.ts +1 -1
- package/lib/components/Sidebar/ApiCallItem.js +10 -3
- package/lib/components/Sidebar/BackButton.d.ts +2 -1
- package/lib/components/Sidebar/BackButton.js +2 -2
- package/lib/components/Sidebar/Drilldown.d.ts +2 -1
- package/lib/components/Sidebar/Drilldown.js +2 -2
- package/lib/components/Sidebar/DrilldownMenu.d.ts +1 -1
- package/lib/components/Sidebar/DrilldownMenu.js +3 -3
- package/lib/components/Sidebar/DrilldownMenuItem.d.ts +1 -1
- package/lib/components/Sidebar/DrilldownMenuItem.js +2 -2
- package/lib/components/Sidebar/HeaderWrapper.d.ts +1 -3
- package/lib/components/Sidebar/HeaderWrapper.js +2 -1
- package/lib/components/Sidebar/MobileSidebarButton.d.ts +1 -3
- package/lib/components/Sidebar/MobileSidebarButton.js +3 -2
- package/lib/components/Sidebar/Sidebar.d.ts +1 -3
- package/lib/components/Sidebar/Sidebar.js +2 -1
- package/lib/components/Sidebar/SidebarLayout.d.ts +2 -1
- package/lib/components/Sidebar/SidebarLayout.js +2 -4
- package/lib/components/Sidebar/types.d.ts +3 -0
- package/lib/components/SidebarActions/SidebarActions.d.ts +2 -1
- package/lib/components/SidebarActions/SidebarActions.js +2 -2
- package/lib/components/SidebarLogo/SidebarLogo.d.ts +2 -1
- package/lib/components/SidebarLogo/SidebarLogo.js +2 -2
- package/lib/components/TableOfContent/TableOfContent.d.ts +1 -0
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/components/Tags/Tags.d.ts +2 -1
- package/lib/components/Tags/Tags.js +2 -2
- package/lib/components/Tiles/TileHeader.d.ts +1 -3
- package/lib/components/Tiles/TileHeader.js +2 -1
- package/lib/components/Tiles/TileText.d.ts +1 -3
- package/lib/components/Tiles/TileText.js +2 -1
- package/lib/components/Typography/CompactTypography.d.ts +1 -3
- package/lib/components/Typography/Emphasis.d.ts +1 -3
- package/lib/components/Typography/Emphasis.js +2 -1
- package/lib/components/Typography/H1.d.ts +1 -3
- package/lib/components/Typography/H1.js +2 -1
- package/lib/components/Typography/H2.d.ts +1 -3
- package/lib/components/Typography/H2.js +2 -1
- package/lib/components/Typography/H3.d.ts +1 -3
- package/lib/components/Typography/H3.js +2 -1
- package/lib/components/Typography/SectionHeader.d.ts +1 -3
- package/lib/components/Typography/SectionHeader.js +2 -1
- package/lib/components/Typography/Typography.d.ts +1 -3
- package/lib/components/Typography/Typography.js +2 -1
- package/lib/globalStyle.js +62 -2
- package/lib/hooks/useMobileMenu.js +7 -1
- package/lib/icons/BurgerIcon/BurgerIcon.d.ts +5 -0
- package/lib/icons/BurgerIcon/BurgerIcon.js +15 -0
- package/lib/icons/BurgerIcon/index.d.ts +1 -0
- package/lib/icons/BurgerIcon/index.js +6 -0
- package/lib/icons/CloseIcon/CloseIcon.d.ts +5 -0
- package/lib/icons/CloseIcon/CloseIcon.js +16 -0
- package/lib/icons/CloseIcon/index.d.ts +1 -0
- package/lib/icons/CloseIcon/index.js +6 -0
- package/lib/icons/ColorModeIcon/ColorModeIcon.js +5 -1
- package/lib/icons/ExpandIcon/ExpandIcon.d.ts +8 -0
- package/lib/icons/ExpandIcon/ExpandIcon.js +31 -0
- package/lib/icons/ExpandIcon/index.d.ts +1 -0
- package/lib/icons/ExpandIcon/index.js +6 -0
- package/lib/icons/LogoutIcon/LogoutIcon.d.ts +5 -0
- package/lib/icons/LogoutIcon/LogoutIcon.js +17 -0
- package/lib/icons/LogoutIcon/index.d.ts +1 -0
- package/lib/icons/LogoutIcon/index.js +6 -0
- package/lib/icons/index.d.ts +4 -0
- package/lib/icons/index.js +4 -0
- package/lib/mocks/Sidebar/useSidebarItems.d.ts +3 -0
- package/lib/mocks/Sidebar/useSidebarItems.js +8 -0
- package/lib/mocks/hooks/index.d.ts +4 -1
- package/lib/mocks/hooks/index.js +16 -1
- package/lib/mocks/media-css.d.ts +5 -0
- package/lib/mocks/media-css.js +5 -0
- package/lib/ui/Dropdown.js +1 -1
- package/lib/ui/darkColors.js +11 -3
- package/package.json +6 -4
- package/src/I18n/LanguagePicker.tsx +2 -1
- package/src/components/Breadcrumbs/Breadcrumb.tsx +0 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +6 -0
- package/src/components/Cards/Card.tsx +2 -1
- package/src/components/Cards/CardsBlock.tsx +2 -1
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/CodeBlock/CodeBlock.ts +2 -1
- package/src/components/CodeSample/CodeSample.tsx +4 -1
- package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +7 -1
- package/src/components/Feedback/Comment.tsx +3 -3
- package/src/components/Feedback/Rating.tsx +2 -2
- package/src/components/Feedback/Reasons.tsx +6 -2
- package/src/components/Feedback/ReportDialog.tsx +1 -1
- package/src/components/Feedback/Sentiment.tsx +2 -2
- package/src/components/Feedback/types.ts +5 -0
- package/src/components/Footer/CustomFooter.tsx +3 -2
- package/src/components/Footer/CustomFooterNavItem.tsx +3 -2
- package/src/components/Footer/Footer.tsx +3 -1
- package/src/components/Footer/FooterColumn.tsx +3 -2
- package/src/components/Footer/FooterColumns.tsx +3 -2
- package/src/components/Footer/FooterCopyright.tsx +6 -1
- package/src/components/LastUpdated/LastUpdated.tsx +2 -0
- package/src/components/Markdown/ContainerWrapper.tsx +5 -4
- package/src/components/Markdown/Heading.tsx +3 -1
- package/src/components/Markdown/MarkdownLayout.tsx +3 -1
- package/src/components/Markdown/MarkdownWrapper.tsx +11 -5
- package/src/components/Markdown/Mermaid.tsx +5 -1
- package/src/components/Markdown/PageWrapper.tsx +2 -1
- package/src/components/Markdown/Sup.tsx +9 -2
- package/src/components/Menu/Menu.tsx +16 -5
- package/src/components/Menu/MenuContainer.tsx +3 -1
- package/src/components/Menu/MenuGroup.tsx +4 -5
- package/src/components/Menu/MenuItem.tsx +22 -4
- package/src/components/Menu/MenuItemLabel.tsx +19 -10
- package/src/components/Menu/MenuItemSwitch.tsx +7 -5
- package/src/components/Menu/MenuLink.tsx +2 -1
- package/src/components/Menu/MenuLinkItem.tsx +2 -1
- package/src/components/Menu/MobileMenu.tsx +209 -0
- package/src/components/Menu/MobileMenuGroup.tsx +73 -0
- package/src/components/Menu/index.ts +1 -0
- package/src/components/Navbar/BurgerButton.tsx +34 -0
- package/src/components/Navbar/MobileUserProfile.tsx +90 -0
- package/src/components/Navbar/Navbar.tsx +43 -14
- package/src/components/Navbar/NavbarDropdown.tsx +3 -2
- package/src/components/Navbar/NavbarMenu.tsx +8 -2
- package/src/components/NavbarLogo/NavbarLogo.tsx +11 -3
- package/src/components/OpenApiDocs/DevOnboardingTryItSecurity.tsx +2 -4
- package/src/components/PageNavigation/NextButton.tsx +3 -1
- package/src/components/PageNavigation/PageNavigation.tsx +10 -2
- package/src/components/PageNavigation/PreviousButton.tsx +3 -1
- package/src/components/Panel/PanelBody.ts +2 -1
- package/src/components/Panel/PanelHeader.ts +2 -1
- package/src/components/Panel/PanelHeaderTitle.ts +2 -1
- package/src/components/Profile/Profile.tsx +2 -2
- package/src/components/Profile/types.ts +1 -0
- package/src/components/SamplesPanelControls/SamplesPanelControls.ts +6 -3
- package/src/components/Search/CancelSearch.tsx +8 -2
- package/src/components/Search/ClearIcon.tsx +2 -1
- package/src/components/Search/ClockBackwardsIcon.tsx +1 -1
- package/src/components/Search/Input.tsx +2 -1
- package/src/components/Search/InputWrapper.tsx +3 -1
- package/src/components/Search/MobileSearchTrigger.tsx +16 -5
- package/src/components/Search/Popover.tsx +3 -2
- package/src/components/Search/RecentSearches.tsx +9 -3
- package/src/components/Search/Search.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +10 -3
- package/src/components/Search/SearchIcon.tsx +2 -1
- package/src/components/Search/SearchItem.tsx +4 -1
- package/src/components/Search/SearchTrigger.tsx +8 -2
- package/src/components/Search/Shortcut.tsx +3 -1
- package/src/components/Search/ShortcutKey.tsx +2 -1
- package/src/components/Search/SidebarSearch.tsx +2 -1
- package/src/components/Search/SuggestedPages.tsx +2 -2
- package/src/components/Separator/Separator.tsx +2 -2
- package/src/components/Separator/SeparatorItem.tsx +11 -4
- package/src/components/Separator/SeparatorLine.tsx +2 -1
- package/src/components/Sidebar/ApiCallItem.tsx +12 -4
- package/src/components/Sidebar/BackButton.tsx +3 -1
- package/src/components/Sidebar/Drilldown.tsx +3 -1
- package/src/components/Sidebar/DrilldownMenu.tsx +3 -2
- package/src/components/Sidebar/DrilldownMenuItem.tsx +2 -2
- package/src/components/Sidebar/HeaderWrapper.tsx +2 -1
- package/src/components/Sidebar/MobileSidebarButton.tsx +3 -2
- package/src/components/Sidebar/Sidebar.tsx +2 -1
- package/src/components/Sidebar/SidebarLayout.tsx +3 -4
- package/src/components/Sidebar/types.ts +3 -0
- package/src/components/SidebarActions/SidebarActions.tsx +3 -0
- package/src/components/SidebarLogo/SidebarLogo.tsx +3 -0
- package/src/components/TableOfContent/TableOfContent.tsx +3 -2
- package/src/components/Tags/Tags.tsx +2 -2
- package/src/components/Tiles/TileHeader.ts +2 -1
- package/src/components/Tiles/TileText.tsx +2 -1
- package/src/components/Typography/Emphasis.ts +2 -1
- package/src/components/Typography/H1.ts +2 -1
- package/src/components/Typography/H2.ts +2 -1
- package/src/components/Typography/H3.ts +2 -1
- package/src/components/Typography/SectionHeader.ts +2 -1
- package/src/components/Typography/Typography.ts +2 -1
- package/src/globalStyle.ts +66 -3
- package/src/hooks/useMobileMenu.ts +5 -1
- package/src/icons/BurgerIcon/BurgerIcon.tsx +12 -0
- package/src/icons/BurgerIcon/index.ts +1 -0
- package/src/icons/CloseIcon/CloseIcon.tsx +13 -0
- package/src/icons/CloseIcon/index.ts +1 -0
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +5 -1
- package/src/icons/ExpandIcon/ExpandIcon.tsx +46 -0
- package/src/icons/ExpandIcon/index.ts +1 -0
- package/src/icons/LogoutIcon/LogoutIcon.tsx +20 -0
- package/src/icons/LogoutIcon/index.ts +1 -0
- package/src/icons/index.ts +4 -0
- package/src/mocks/Sidebar/useSidebarItems.tsx +7 -0
- package/src/mocks/hooks/index.ts +16 -1
- package/src/mocks/media-css.ts +1 -0
- package/src/ui/Dropdown.tsx +1 -1
- package/src/ui/darkColors.tsx +11 -3
- package/lib/components/Navbar/MobileNavbarDropdown.d.ts +0 -8
- package/lib/components/Navbar/MobileNavbarDropdown.js +0 -30
- package/lib/components/Navbar/MobileNavbarItem.d.ts +0 -15
- package/lib/components/Navbar/MobileNavbarItem.js +0 -110
- package/lib/components/Navbar/MobileNavbarMenu.d.ts +0 -6
- package/lib/components/Navbar/MobileNavbarMenu.js +0 -92
- package/lib/components/Navbar/MobileNavbarMenuButton.d.ts +0 -4
- package/lib/components/Navbar/MobileNavbarMenuButton.js +0 -18
- package/src/components/Navbar/MobileNavbarDropdown.tsx +0 -37
- package/src/components/Navbar/MobileNavbarItem.tsx +0 -121
- package/src/components/Navbar/MobileNavbarMenu.tsx +0 -111
- package/src/components/Navbar/MobileNavbarMenuButton.tsx +0 -13
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { useProfileProps } from '@portal/Profile/useProfileProps';
|
|
5
|
+
import { LogoutIcon } from '@theme/icons/LogoutIcon';
|
|
6
|
+
import { AvatarWrapper, ProfileWrapper, Profile } from '@theme/components/Profile/Profile';
|
|
7
|
+
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
|
8
|
+
import { useTranslate } from '@portal/hooks';
|
|
9
|
+
|
|
10
|
+
export function MobileUserProfile(): JSX.Element {
|
|
11
|
+
const { userProfile } = useThemeConfig();
|
|
12
|
+
const { userData, handleLogout, loginUrl } = useProfileProps();
|
|
13
|
+
const { translate } = useTranslate();
|
|
14
|
+
const translationKeys = {
|
|
15
|
+
login: 'theme.profile.login',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (!userData?.isAuthenticated) {
|
|
19
|
+
return (
|
|
20
|
+
<MobileProfileWrapper data-component-name="Navbar/MobileUserProfile">
|
|
21
|
+
<LoginButton href={loginUrl} data-cy="login-btn">
|
|
22
|
+
{translate(translationKeys.login, userProfile?.loginLabel || 'Login')}
|
|
23
|
+
</LoginButton>
|
|
24
|
+
</MobileProfileWrapper>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<MobileProfileWrapper data-component-name="Navbar/MobileUserProfile">
|
|
30
|
+
<UserDataWrapper>
|
|
31
|
+
<ProfilePicture>
|
|
32
|
+
<Profile name={userData.name} imageUrl={userData.picture} />
|
|
33
|
+
</ProfilePicture>
|
|
34
|
+
<UserName>{userData.name}</UserName>
|
|
35
|
+
</UserDataWrapper>
|
|
36
|
+
<LogoutButton onClick={() => handleLogout()}>
|
|
37
|
+
<LogoutIcon />
|
|
38
|
+
</LogoutButton>
|
|
39
|
+
</MobileProfileWrapper>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const LoginButton = styled.a`
|
|
43
|
+
background: var(--mobile-menu-login-button-background);
|
|
44
|
+
border-radius: 6px;
|
|
45
|
+
width: 100%;
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 5px 0;
|
|
48
|
+
color: var(--mobile-menu-login-button-color);
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
text-align: center;
|
|
51
|
+
line-height: 22px;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const MobileProfileWrapper = styled.div`
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
align-items: center;
|
|
60
|
+
width: 100%;
|
|
61
|
+
position: fixed;
|
|
62
|
+
bottom: 0;
|
|
63
|
+
padding: 18px 16px;
|
|
64
|
+
border-top: 1px solid var(--mobile-menu-profile-border-color);
|
|
65
|
+
background: var(--mobile-menu-profile-background);
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
const UserDataWrapper = styled.div`
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
const ProfilePicture = styled.div`
|
|
74
|
+
margin-right: 16px;
|
|
75
|
+
|
|
76
|
+
${AvatarWrapper} {
|
|
77
|
+
margin: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
${ProfileWrapper} {
|
|
81
|
+
padding: 0;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
const UserName = styled.div``;
|
|
86
|
+
|
|
87
|
+
const LogoutButton = styled.div`
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
user-select: none;
|
|
90
|
+
`;
|
|
@@ -4,17 +4,19 @@ import styled, { createGlobalStyle } from 'styled-components';
|
|
|
4
4
|
import { NavbarMenu } from '@theme/components/Navbar';
|
|
5
5
|
import { useMobileMenu } from '@theme/hooks/useMobileMenu';
|
|
6
6
|
import { isEmptyArray, isPrimitive } from '@theme/utils';
|
|
7
|
-
import { MobileNavbarMenuButton } from '@theme/components/Navbar/MobileNavbarMenuButton';
|
|
8
7
|
import type { NavbarLogoProps } from '@theme/components/NavbarLogo';
|
|
9
8
|
import { NavbarLogo } from '@theme/components/NavbarLogo';
|
|
10
|
-
import {
|
|
9
|
+
import { MobileMenu } from '@theme/components/Menu/MobileMenu';
|
|
11
10
|
import { ColorModeSwitcher } from '@theme/components/ColorModeSwitcher/ColorModeSwitcher';
|
|
12
11
|
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
|
13
12
|
import { Search } from '@theme/components/Search/Search';
|
|
14
13
|
import { AuthUserProfile } from '@theme/components/Profile/AuthUserProfile';
|
|
15
|
-
import type { LogoConfig, ResolvedConfigLinks } from '@theme/types/portal';
|
|
16
|
-
import { useI18n } from '@portal/hooks';
|
|
17
|
-
import {
|
|
14
|
+
import type { LogoConfig, ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
|
|
15
|
+
import { useI18n, usePageVersions } from '@portal/hooks';
|
|
16
|
+
import { BurgerButton } from '@theme/components/Navbar/BurgerButton';
|
|
17
|
+
import { useSidebarItems } from '@portal/Sidebar/useSidebarItems';
|
|
18
|
+
|
|
19
|
+
import { LanguagePicker } from '../../I18n/LanguagePicker';
|
|
18
20
|
|
|
19
21
|
const EmptyNavbarHack = createGlobalStyle`
|
|
20
22
|
:root {
|
|
@@ -74,9 +76,14 @@ interface NavbarPresentationalProps extends NavbarLogoProps {
|
|
|
74
76
|
menu: ResolvedConfigLinks;
|
|
75
77
|
hideUserProfile: boolean | string | undefined;
|
|
76
78
|
changeLanguage: (value: string) => void;
|
|
79
|
+
className?: string;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
export function NavbarPresentational(props: NavbarPresentationalProps): JSX.Element | null {
|
|
83
|
+
const { versions = [] } = usePageVersions() || {};
|
|
84
|
+
const activeVersion = versions.find((version) => version?.active);
|
|
85
|
+
const sidebarItems = useSidebarItems(activeVersion);
|
|
86
|
+
|
|
80
87
|
const {
|
|
81
88
|
menuItemsExist,
|
|
82
89
|
closeMobileMenu,
|
|
@@ -87,26 +94,48 @@ export function NavbarPresentational(props: NavbarPresentationalProps): JSX.Elem
|
|
|
87
94
|
menu,
|
|
88
95
|
hideUserProfile,
|
|
89
96
|
changeLanguage,
|
|
97
|
+
className,
|
|
90
98
|
} = props;
|
|
91
99
|
return (
|
|
92
|
-
<NavbarContainer data-component-name="Navbar/Navbar">
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
{isOpen && (
|
|
96
|
-
<MobileNavbarMenu closeMenu={closeMobileMenu} menuItems={menu as ResolvedConfigLinks} />
|
|
97
|
-
)}
|
|
100
|
+
<NavbarContainer data-component-name="Navbar/Navbar" className={className}>
|
|
101
|
+
{isOpen && <MobileMenu navItems={menu as ResolvedNavItem[]} sidebarItems={sidebarItems} />}
|
|
98
102
|
<NavbarRow>
|
|
103
|
+
{menuItemsExist && (
|
|
104
|
+
<BurgerButton onClick={isOpen ? closeMobileMenu : openMobileMenu} isOpen={isOpen} />
|
|
105
|
+
)}
|
|
99
106
|
<NavbarLogo logo={logo} />
|
|
100
107
|
<NavbarMenu menuItems={menu as ResolvedConfigLinks} />
|
|
101
108
|
{hideSearch ? null : <Search />}
|
|
102
109
|
<LanguagePicker onChangeLanguage={changeLanguage} />
|
|
103
|
-
{hideUserProfile ? null :
|
|
104
|
-
|
|
110
|
+
{hideUserProfile ? null : (
|
|
111
|
+
<AuthUserProfileWrapper>
|
|
112
|
+
<AuthUserProfile />
|
|
113
|
+
</AuthUserProfileWrapper>
|
|
114
|
+
)}
|
|
115
|
+
<ColorModeSwitcherWrapper isVisible={isOpen}>
|
|
116
|
+
<ColorModeSwitcher />
|
|
117
|
+
</ColorModeSwitcherWrapper>
|
|
105
118
|
</NavbarRow>
|
|
106
119
|
</NavbarContainer>
|
|
107
120
|
);
|
|
108
121
|
}
|
|
109
122
|
|
|
123
|
+
const ColorModeSwitcherWrapper = styled.div<{ isVisible: boolean }>`
|
|
124
|
+
display: ${({ isVisible }) => (isVisible ? 'block' : 'none')};
|
|
125
|
+
|
|
126
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
127
|
+
display: block;
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
const AuthUserProfileWrapper = styled.div`
|
|
132
|
+
display: none;
|
|
133
|
+
|
|
134
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
135
|
+
display: block;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
|
|
110
139
|
export const NavbarContainer = styled.nav`
|
|
111
140
|
--text-color: var(--navbar-text-color);
|
|
112
141
|
|
|
@@ -119,7 +148,7 @@ export const NavbarContainer = styled.nav`
|
|
|
119
148
|
font-size: 0.875rem;
|
|
120
149
|
position: sticky;
|
|
121
150
|
top: 0;
|
|
122
|
-
z-index:
|
|
151
|
+
z-index: var(--z-index-raised);
|
|
123
152
|
padding: var(--navbar-item-padding-vertical) var(--navbar-item-padding-horizontal);
|
|
124
153
|
background: var(--navbar-background-color);
|
|
125
154
|
font-family: var(--navbar-item-font-family);
|
|
@@ -7,12 +7,13 @@ import { useTranslate } from '@portal/hooks';
|
|
|
7
7
|
|
|
8
8
|
interface NavbarDropdownProps {
|
|
9
9
|
items: ResolvedNavLinkItem[];
|
|
10
|
+
className?: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export function NavbarDropdown({ items }: NavbarDropdownProps): JSX.Element {
|
|
13
|
+
export function NavbarDropdown({ items, className }: NavbarDropdownProps): JSX.Element {
|
|
13
14
|
const { translate } = useTranslate();
|
|
14
15
|
return (
|
|
15
|
-
<DropdownWrapper data-component-name="Navbar/NavbarDropdown">
|
|
16
|
+
<DropdownWrapper data-component-name="Navbar/NavbarDropdown" className={className}>
|
|
16
17
|
{items.map((item, index) => (
|
|
17
18
|
<div key={`${item.label}_${index}`}>
|
|
18
19
|
<Link to={item.link}>{translate(item.labelTranslationKey, item.label)}</Link>
|
|
@@ -5,13 +5,19 @@ import { NavbarItem } from '@theme/components/Navbar/NavbarItem';
|
|
|
5
5
|
import { isPrimitive } from '@theme/utils';
|
|
6
6
|
import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
|
|
7
7
|
|
|
8
|
-
export function NavbarMenu({
|
|
8
|
+
export function NavbarMenu({
|
|
9
|
+
menuItems,
|
|
10
|
+
className,
|
|
11
|
+
}: {
|
|
12
|
+
menuItems: ResolvedConfigLinks;
|
|
13
|
+
className?: string;
|
|
14
|
+
}): JSX.Element | null {
|
|
9
15
|
if (isPrimitive(menuItems)) {
|
|
10
16
|
return null;
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
return (
|
|
14
|
-
<NavItemsContainer data-component-name="Navbar/NavbarMenu">
|
|
20
|
+
<NavItemsContainer data-component-name="Navbar/NavbarMenu" className={className}>
|
|
15
21
|
{(menuItems as ResolvedNavItem[]).map((navItem, index) => {
|
|
16
22
|
return (
|
|
17
23
|
<NavbarItem key={`${navItem.label}_${index}`} data-cy={navItem.label} navItem={navItem} />
|
|
@@ -4,14 +4,22 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { Link } from '@portal/Link';
|
|
5
5
|
import type { LogoConfig } from '@theme/types/portal';
|
|
6
6
|
|
|
7
|
-
export type NavbarLogoProps = {
|
|
7
|
+
export type NavbarLogoProps = {
|
|
8
|
+
logo: Pick<LogoConfig, 'image' | 'link' | 'altText'>;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
8
11
|
|
|
9
|
-
export function NavbarLogo({ logo }: NavbarLogoProps): JSX.Element | null {
|
|
12
|
+
export function NavbarLogo({ logo, className }: NavbarLogoProps): JSX.Element | null {
|
|
10
13
|
if (!logo.image) {
|
|
11
14
|
return null;
|
|
12
15
|
}
|
|
13
16
|
const img = (
|
|
14
|
-
<NavLogo
|
|
17
|
+
<NavLogo
|
|
18
|
+
className={className}
|
|
19
|
+
src={logo.image}
|
|
20
|
+
alt={logo.altText}
|
|
21
|
+
data-component-name="NavbarLogo/NavbarLogo"
|
|
22
|
+
/>
|
|
15
23
|
);
|
|
16
24
|
return logo.link ? <Link to={logo.link}>{img}</Link> : img;
|
|
17
25
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type { TryItSecurityAppsProps } from '
|
|
5
|
-
|
|
4
|
+
import type { TryItSecurityAppsProps } from '@theme/components/OpenApiDocs/TryItSecurityApps';
|
|
6
5
|
import { Button } from '@theme/components/Button/Button';
|
|
7
6
|
import { usePreloadHistory } from '@portal/usePreloadHistory';
|
|
8
7
|
import { usePageData } from '@portal/hooks/usePageData';
|
|
9
|
-
|
|
10
|
-
import { Dropdown } from './Dropdown';
|
|
8
|
+
import { Dropdown } from '@theme/components/OpenApiDocs/Dropdown';
|
|
11
9
|
|
|
12
10
|
export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
|
|
13
11
|
const apiId = (props as any).apiId;
|
|
@@ -8,9 +8,10 @@ import { useTranslate } from '@portal/hooks';
|
|
|
8
8
|
|
|
9
9
|
interface NextPageType {
|
|
10
10
|
nextPage?: ResolvedNavItemWithLink | null;
|
|
11
|
+
className?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export function NextButton({ nextPage }: NextPageType): JSX.Element {
|
|
14
|
+
export function NextButton({ nextPage, className }: NextPageType): JSX.Element {
|
|
14
15
|
const { navigation } = useThemeConfig();
|
|
15
16
|
const { translate } = useTranslate();
|
|
16
17
|
|
|
@@ -33,6 +34,7 @@ export function NextButton({ nextPage }: NextPageType): JSX.Element {
|
|
|
33
34
|
to={nextPage.link}
|
|
34
35
|
data-component-name="PageNavigation/NextPageLink"
|
|
35
36
|
data-translation-key={translationKey}
|
|
37
|
+
extraClass={className}
|
|
36
38
|
>
|
|
37
39
|
{text}
|
|
38
40
|
</StyledButton>
|
|
@@ -9,9 +9,14 @@ import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
|
9
9
|
interface PageNavigationType {
|
|
10
10
|
nextPage?: ResolvedNavItemWithLink | null;
|
|
11
11
|
prevPage?: ResolvedNavItemWithLink | null;
|
|
12
|
+
className?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export function PageNavigation({
|
|
15
|
+
export function PageNavigation({
|
|
16
|
+
nextPage,
|
|
17
|
+
prevPage,
|
|
18
|
+
className,
|
|
19
|
+
}: PageNavigationType): JSX.Element | null {
|
|
15
20
|
const { navigation } = useThemeConfig();
|
|
16
21
|
|
|
17
22
|
if (navigation?.previousButton?.hide && navigation?.nextButton?.hide) {
|
|
@@ -19,7 +24,10 @@ export function PageNavigation({ nextPage, prevPage }: PageNavigationType): JSX.
|
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
return (
|
|
22
|
-
<PageNavigationWrapper
|
|
27
|
+
<PageNavigationWrapper
|
|
28
|
+
data-component-name="PageNavigation/PageNavigation"
|
|
29
|
+
className={className}
|
|
30
|
+
>
|
|
23
31
|
<PreviousButton prevPage={prevPage} />
|
|
24
32
|
<NextButton nextPage={nextPage} />
|
|
25
33
|
</PageNavigationWrapper>
|
|
@@ -8,9 +8,10 @@ import { useTranslate } from '@portal/hooks';
|
|
|
8
8
|
|
|
9
9
|
interface PreviousPageType {
|
|
10
10
|
prevPage?: ResolvedNavItemWithLink | null;
|
|
11
|
+
className?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export function PreviousButton({ prevPage }: PreviousPageType): JSX.Element {
|
|
14
|
+
export function PreviousButton({ prevPage, className }: PreviousPageType): JSX.Element {
|
|
14
15
|
const { navigation } = useThemeConfig();
|
|
15
16
|
const { translate } = useTranslate();
|
|
16
17
|
|
|
@@ -36,6 +37,7 @@ export function PreviousButton({ prevPage }: PreviousPageType): JSX.Element {
|
|
|
36
37
|
to={prevPage.link}
|
|
37
38
|
data-component-name="PageNavigation/PreviousPageLink"
|
|
38
39
|
data-translation-key={translationKey}
|
|
40
|
+
extraClass={className}
|
|
39
41
|
>
|
|
40
42
|
{text}
|
|
41
43
|
</StyledButton>
|
|
@@ -18,8 +18,9 @@ interface PanelBodyProps {
|
|
|
18
18
|
hidden?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const PanelBody = styled.div.attrs(() => ({
|
|
21
|
+
export const PanelBody = styled.div.attrs<{ className?: string }>(({ className }) => ({
|
|
22
22
|
'data-component-name': 'Panel/PanelBody',
|
|
23
|
+
className,
|
|
23
24
|
}))<PanelBodyProps>`
|
|
24
25
|
${({ animate }) => animate && showPanelAnimation};
|
|
25
26
|
${({ hidden }) => hidden && 'visibility: hidden'};
|
|
@@ -8,8 +8,9 @@ export interface PanelHeaderProps {
|
|
|
8
8
|
toggle?: (e: BaseSyntheticEvent) => void;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const PanelHeader = styled.div.attrs(() => ({
|
|
11
|
+
export const PanelHeader = styled.div.attrs<{ className?: string }>(({ className }) => ({
|
|
12
12
|
'data-component-name': 'Panel/PanelHeader',
|
|
13
|
+
className,
|
|
13
14
|
}))<PanelHeaderProps>`
|
|
14
15
|
position: relative;
|
|
15
16
|
z-index: 1;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const PanelHeaderTitle = styled.span.attrs(() => ({
|
|
3
|
+
export const PanelHeaderTitle = styled.span.attrs<{ className?: string }>(({ className }) => ({
|
|
4
4
|
'data-component-name': 'Panel/PanelHeaderTitle',
|
|
5
|
+
className,
|
|
5
6
|
}))`
|
|
6
7
|
margin-right: 5px;
|
|
7
8
|
font-weight: var(--panel-heading-font-weight-local);
|
|
@@ -44,7 +44,7 @@ function ProfileComponent({ name = 'User', imageUrl, onClick, color }: ProfilePr
|
|
|
44
44
|
|
|
45
45
|
export const Profile = memo<ProfileProps>(ProfileComponent);
|
|
46
46
|
|
|
47
|
-
const ProfileWrapper = styled.div.attrs(() => ({
|
|
47
|
+
export const ProfileWrapper = styled.div.attrs(() => ({
|
|
48
48
|
'data-component-name': 'Profile/Profile',
|
|
49
49
|
}))`
|
|
50
50
|
display: flex;
|
|
@@ -69,7 +69,7 @@ const StyledUserName = styled.span`
|
|
|
69
69
|
}
|
|
70
70
|
`;
|
|
71
71
|
|
|
72
|
-
const AvatarWrapper = styled.div<{ background?: string }>`
|
|
72
|
+
export const AvatarWrapper = styled.div<{ background?: string }>`
|
|
73
73
|
width: var(--profile-avatar-width);
|
|
74
74
|
height: var(--profile-avatar-height);
|
|
75
75
|
display: flex;
|
|
@@ -2,9 +2,12 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { CodeBlock } from '@theme/components/CodeBlock';
|
|
4
4
|
|
|
5
|
-
export const SamplesControlButton = styled.button.attrs
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export const SamplesControlButton = styled.button.attrs<{ className?: string }>(
|
|
6
|
+
({ className }) => ({
|
|
7
|
+
'data-component-name': 'SamplesPanelControls/SamplesPanelControls',
|
|
8
|
+
className: className,
|
|
9
|
+
}),
|
|
10
|
+
)`
|
|
8
11
|
background-color: var(--panel-samples-controls-background-color);
|
|
9
12
|
border: 0;
|
|
10
13
|
outline: 0;
|
|
@@ -3,14 +3,20 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { useTranslate } from '@theme/mocks/hooks';
|
|
5
5
|
|
|
6
|
-
export function CancelSearch({
|
|
6
|
+
export function CancelSearch({
|
|
7
|
+
onClick,
|
|
8
|
+
className,
|
|
9
|
+
}: {
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): JSX.Element {
|
|
7
13
|
const { translate } = useTranslate();
|
|
8
14
|
const translationKeys = {
|
|
9
15
|
cancel: 'theme.search.cancel',
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
return (
|
|
13
|
-
<Wrapper data-component-name="Search/CancelSearch" onClick={onClick}>
|
|
19
|
+
<Wrapper data-component-name="Search/CancelSearch" onClick={onClick} className={className}>
|
|
14
20
|
<Button data-translation-keys={translationKeys.cancel}>
|
|
15
21
|
{translate(translationKeys.cancel, 'Cancel')}
|
|
16
22
|
</Button>
|
|
@@ -17,8 +17,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
17
17
|
</svg>
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
export const ClearIcon = styled(Icon).attrs(() => ({
|
|
20
|
+
export const ClearIcon = styled(Icon).attrs<{ className?: string }>(({ className }) => ({
|
|
21
21
|
'data-component-name': 'Search/ClearIcon',
|
|
22
|
+
className,
|
|
22
23
|
}))`
|
|
23
24
|
cursor: pointer;
|
|
24
25
|
width: 0.5em;
|
|
@@ -10,7 +10,7 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
10
10
|
</svg>
|
|
11
11
|
);
|
|
12
12
|
|
|
13
|
-
export const ClockBackwardsIcon = styled(Icon).attrs
|
|
13
|
+
export const ClockBackwardsIcon = styled(Icon).attrs<{ className?: string }>(({ className }) => ({
|
|
14
14
|
'data-component-name': 'Search/RecentlyViewedIcon',
|
|
15
15
|
className,
|
|
16
16
|
}))`
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const FormInput = styled.input.attrs(() => ({
|
|
3
|
+
export const FormInput = styled.input.attrs<{ className?: string }>(({ className }) => ({
|
|
4
4
|
'data-component-name': 'Search/Input',
|
|
5
|
+
className,
|
|
5
6
|
}))`
|
|
6
7
|
padding: 1em 2.5em 1em 2.5em;
|
|
7
8
|
background-color: var(--search-input-background-color);
|
|
@@ -14,6 +14,7 @@ interface InputWrapperProps {
|
|
|
14
14
|
change(value: string): void;
|
|
15
15
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
16
16
|
isLoading: boolean;
|
|
17
|
+
className?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export function InputWrapper({
|
|
@@ -21,6 +22,7 @@ export function InputWrapper({
|
|
|
21
22
|
value,
|
|
22
23
|
change,
|
|
23
24
|
isLoading,
|
|
25
|
+
className,
|
|
24
26
|
}: InputWrapperProps): JSX.Element {
|
|
25
27
|
const [isFocused, setIsFocused] = useState(false);
|
|
26
28
|
|
|
@@ -45,7 +47,7 @@ export function InputWrapper({
|
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
|
-
<Wrapper data-component-name="Search/InputContainer">
|
|
50
|
+
<Wrapper data-component-name="Search/InputContainer" className={className}>
|
|
49
51
|
{isFocused && isLoading ? <SpinnerIcon /> : <SearchIcon />}
|
|
50
52
|
<FormInput
|
|
51
53
|
value={value}
|
|
@@ -3,23 +3,34 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { SearchIcon as ThemeSearchIcon } from '@theme/components/Search/SearchIcon';
|
|
5
5
|
|
|
6
|
-
export function MobileSearchTrigger({
|
|
6
|
+
export function MobileSearchTrigger({
|
|
7
|
+
onClick,
|
|
8
|
+
className,
|
|
9
|
+
}: {
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): JSX.Element {
|
|
7
13
|
return (
|
|
8
|
-
<Wrapper
|
|
14
|
+
<Wrapper
|
|
15
|
+
data-component-name="Search/MobileSearchTrigger"
|
|
16
|
+
onClick={onClick}
|
|
17
|
+
className={className}
|
|
18
|
+
>
|
|
9
19
|
<SearchIcon />
|
|
10
20
|
</Wrapper>
|
|
11
21
|
);
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
const SearchIcon = styled(ThemeSearchIcon)`
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
17
|
-
fill:
|
|
25
|
+
width: var(--mobile-menu-search-icon-size);
|
|
26
|
+
height: var(--mobile-menu-search-icon-size);
|
|
27
|
+
fill: var(--navbar-text-color);
|
|
18
28
|
`;
|
|
19
29
|
|
|
20
30
|
const Wrapper = styled.div`
|
|
21
31
|
display: block;
|
|
22
32
|
user-select: none;
|
|
33
|
+
height: var(--mobile-menu-search-icon-size);
|
|
23
34
|
|
|
24
35
|
${({ theme }) => theme.mediaQueries.small} {
|
|
25
36
|
display: none;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const Popover = styled.div.attrs(() => ({
|
|
3
|
+
export const Popover = styled.div.attrs<{ className?: string }>(({ className }) => ({
|
|
4
4
|
'data-component-name': 'Search/Popover',
|
|
5
|
+
className,
|
|
5
6
|
}))`
|
|
6
7
|
position: absolute;
|
|
7
8
|
top: calc(100% + 10px);
|
|
8
9
|
right: 0;
|
|
9
|
-
z-index:
|
|
10
|
+
z-index: var(--z-index-raised);
|
|
10
11
|
min-width: 100%;
|
|
11
12
|
max-width: 90vw;
|
|
12
13
|
max-height: 400px;
|
|
@@ -6,7 +6,13 @@ import { ClearIcon as ThemeClearIcon } from '@theme/components/Search/ClearIcon'
|
|
|
6
6
|
import { useRecentSearches } from '@portal/search';
|
|
7
7
|
import { useTranslate } from '@portal/hooks';
|
|
8
8
|
|
|
9
|
-
export function RecentSearches({
|
|
9
|
+
export function RecentSearches({
|
|
10
|
+
onSelect,
|
|
11
|
+
className,
|
|
12
|
+
}: {
|
|
13
|
+
onSelect: (value: string) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
}) {
|
|
10
16
|
const { items, removeSearchHistoryItem } = useRecentSearches();
|
|
11
17
|
const { translate } = useTranslate();
|
|
12
18
|
const translationKeys = {
|
|
@@ -27,7 +33,7 @@ export function RecentSearches({ onSelect }: { onSelect: (value: string) => void
|
|
|
27
33
|
};
|
|
28
34
|
|
|
29
35
|
return (
|
|
30
|
-
<Wrapper data-component-name="Search/RecentSearches">
|
|
36
|
+
<Wrapper data-component-name="Search/RecentSearches" className={className}>
|
|
31
37
|
<Title data-translation-key={translationKeys.title}>
|
|
32
38
|
{translate(translationKeys.title, 'Recent searches')}
|
|
33
39
|
</Title>
|
|
@@ -82,7 +88,7 @@ const ClearIcon = styled(ThemeClearIcon)`
|
|
|
82
88
|
display: inline;
|
|
83
89
|
width: 10px;
|
|
84
90
|
height: 10px;
|
|
85
|
-
fill: var(--search-item-active-text-color)
|
|
91
|
+
fill: var(--search-item-active-text-color);
|
|
86
92
|
`;
|
|
87
93
|
|
|
88
94
|
const Item = styled.div`
|
|
@@ -8,7 +8,7 @@ import { MobileSearchTrigger } from '@theme/components/Search/MobileSearchTrigge
|
|
|
8
8
|
import { SearchDialog } from '@theme/components/Search/SearchDialog';
|
|
9
9
|
import { useThemeConfig } from '@theme/hooks';
|
|
10
10
|
|
|
11
|
-
export function Search(): JSX.Element {
|
|
11
|
+
export function Search({ className }: { className?: string }): JSX.Element {
|
|
12
12
|
const [isOpen, setIsOpen] = useState(false);
|
|
13
13
|
const themeSettings = useThemeConfig();
|
|
14
14
|
const location = useLocation();
|
|
@@ -33,7 +33,7 @@ export function Search(): JSX.Element {
|
|
|
33
33
|
useEffect(onClose, [location, onClose]);
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<Wrapper data-component-name="Search/Search">
|
|
36
|
+
<Wrapper data-component-name="Search/Search" className={className}>
|
|
37
37
|
<SearchTrigger onClick={() => setIsOpen(true)} />
|
|
38
38
|
<MobileSearchTrigger onClick={() => setIsOpen(true)} />
|
|
39
39
|
|
|
@@ -3,6 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import type { MouseEvent } from 'react';
|
|
5
5
|
|
|
6
|
+
import { concatClassNames } from '@theme/utils';
|
|
6
7
|
import { useFuseSearch } from '@portal/search';
|
|
7
8
|
import { InputWrapper } from '@theme/components/Search/InputWrapper';
|
|
8
9
|
import { SearchItem } from '@theme/components/Search/SearchItem';
|
|
@@ -14,7 +15,13 @@ import { SuggestedPages } from '@theme/components/Search/SuggestedPages';
|
|
|
14
15
|
import { CancelSearch } from '@theme/components/Search/CancelSearch';
|
|
15
16
|
import { useDialogHotKeys } from '@theme/hooks/useDialogHotKeys';
|
|
16
17
|
|
|
17
|
-
export const SearchDialog = ({
|
|
18
|
+
export const SearchDialog = ({
|
|
19
|
+
onClose,
|
|
20
|
+
className,
|
|
21
|
+
}: {
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
}): JSX.Element => {
|
|
18
25
|
const { query, setQuery, items, isLoading } = useFuseSearch();
|
|
19
26
|
const modalRef = useRef<HTMLDivElement>(null);
|
|
20
27
|
const { translate } = useTranslate();
|
|
@@ -45,7 +52,7 @@ export const SearchDialog = ({ onClose }: { onClose: () => void }): JSX.Element
|
|
|
45
52
|
data-component-name="Search/SearchDialog"
|
|
46
53
|
ref={modalRef}
|
|
47
54
|
onClick={handleOverlayClick}
|
|
48
|
-
className=
|
|
55
|
+
className={concatClassNames('overlay', className)}
|
|
49
56
|
>
|
|
50
57
|
<Container>
|
|
51
58
|
<TopContainer>
|
|
@@ -105,7 +112,7 @@ const Overlay = styled.div`
|
|
|
105
112
|
width: 100vw;
|
|
106
113
|
height: 100vh;
|
|
107
114
|
background: var(--modal-overlay-background-color);
|
|
108
|
-
z-index:
|
|
115
|
+
z-index: var(--z-index-overlay);
|
|
109
116
|
display: flex;
|
|
110
117
|
align-items: center;
|
|
111
118
|
justify-content: center;
|