@redocly/theme 0.1.6 → 0.1.9
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/Footer/Footer.d.ts +3 -0
- package/Footer/Footer.js +35 -0
- package/Footer/FooterColumn.d.ts +7 -0
- package/Footer/FooterColumn.js +39 -0
- package/Footer/FooterColumns.d.ts +7 -0
- package/Footer/FooterColumns.js +44 -0
- package/Footer/FooterCopyright.d.ts +5 -0
- package/Footer/FooterCopyright.js +30 -0
- package/Footer/index.d.ts +4 -0
- package/Footer/index.js +20 -0
- package/JsonViewer/JsonViewer.js +1 -1
- package/JsonViewer/index.d.ts +1 -0
- package/JsonViewer/index.js +1 -0
- package/Layout/PageLayout.d.ts +6 -0
- package/Layout/PageLayout.js +31 -0
- package/Layout/RootLayout.d.ts +7 -0
- package/Layout/RootLayout.js +32 -0
- package/Layout/index.d.ts +2 -0
- package/Layout/index.js +18 -0
- package/Logo/Logo.d.ts +1 -6
- package/Logo/index.d.ts +1 -0
- package/Logo/index.js +17 -0
- package/Markdown/Admonition.d.ts +9 -0
- package/Markdown/Admonition.js +39 -0
- package/Markdown/CodeSample/CodeSample.d.ts +8 -0
- package/Markdown/CodeSample/CodeSample.js +30 -0
- package/Markdown/CodeSample/index.d.ts +3 -0
- package/Markdown/CodeSample/index.js +19 -0
- package/Markdown/CodeSample/styled.d.ts +5 -0
- package/Markdown/CodeSample/styled.js +109 -0
- package/Markdown/CodeSample/types.d.ts +9 -0
- package/Markdown/CodeSample/types.js +2 -0
- package/Markdown/ContentWrapper.d.ts +5 -0
- package/Markdown/ContentWrapper.js +21 -0
- package/Markdown/Heading.d.ts +5 -0
- package/Markdown/Heading.js +23 -0
- package/Markdown/MarkdownLayout.d.ts +7 -0
- package/Markdown/MarkdownLayout.js +23 -0
- package/Markdown/Mermaid.d.ts +6 -0
- package/Markdown/Mermaid.js +19 -0
- package/Markdown/PageWrapper.d.ts +3 -0
- package/Markdown/PageWrapper.js +15 -0
- package/Markdown/StyledMarkdown.d.ts +8 -0
- package/Markdown/StyledMarkdown.js +54 -0
- package/Markdown/Tabs/Tab.d.ts +8 -0
- package/Markdown/Tabs/Tab.js +35 -0
- package/Markdown/Tabs/Tabs.d.ts +10 -0
- package/Markdown/Tabs/Tabs.js +43 -0
- package/Markdown/Tabs/index.d.ts +2 -0
- package/Markdown/Tabs/index.js +18 -0
- package/Markdown/index.d.ts +9 -0
- package/Markdown/index.js +25 -0
- package/Navbar/Navbar.d.ts +2 -1
- package/Navbar/Navbar.js +9 -3
- package/Navbar/NavbarItem.d.ts +1 -1
- package/Navbar/NavbarItem.js +3 -3
- package/Navbar/NavbarMenu.d.ts +1 -1
- package/Navbar/NavbarMenu.js +8 -4
- package/OperationBadge/OperationBadge.d.ts +5 -0
- package/OperationBadge/OperationBadge.js +15 -0
- package/OperationBadge/index.d.ts +1 -0
- package/OperationBadge/index.js +17 -0
- package/PageNavigation/NextPageLink.d.ts +2 -0
- package/PageNavigation/NextPageLink.js +25 -0
- package/PageNavigation/PageNavigation.d.ts +2 -0
- package/PageNavigation/PageNavigation.js +31 -0
- package/PageNavigation/PreviousPageLink.d.ts +2 -0
- package/PageNavigation/PreviousPageLink.js +25 -0
- package/Panel/CodePanel.js +6 -6
- package/Panel/ContentPanel.js +4 -4
- package/Panel/Panel.d.ts +1 -1
- package/Panel/Panel.js +3 -3
- package/Panel/PanelComponent.d.ts +1 -1
- package/Panel/PanelComponent.js +3 -3
- package/Panel/index.d.ts +1 -0
- package/Panel/index.js +1 -0
- package/Search/Autocomplete.d.ts +13 -0
- package/Search/Autocomplete.js +79 -0
- package/Search/ClearIcon.d.ts +2 -0
- package/Search/ClearIcon.js +29 -0
- package/Search/Input.d.ts +3 -0
- package/Search/Input.js +15 -0
- package/Search/Parameters.d.ts +7 -0
- package/Search/Parameters.js +42 -0
- package/Search/Popover.d.ts +3 -0
- package/Search/Popover.js +15 -0
- package/Search/Search.d.ts +2 -0
- package/Search/Search.js +39 -0
- package/Search/SearchIcon.d.ts +2 -0
- package/Search/SearchIcon.js +29 -0
- package/Search/SearchItem.d.ts +7 -0
- package/Search/SearchItem.js +47 -0
- package/Search/index.d.ts +9 -0
- package/Search/index.js +25 -0
- package/Search/utils.d.ts +2 -0
- package/Search/utils.js +21 -0
- package/Sidebar/ApiCallItem.d.ts +8 -0
- package/Sidebar/ApiCallItem.js +35 -0
- package/Sidebar/ArrowBack.d.ts +4 -0
- package/Sidebar/ArrowBack.js +29 -0
- package/Sidebar/BackButton.d.ts +6 -0
- package/Sidebar/BackButton.js +31 -0
- package/Sidebar/Drilldown.d.ts +8 -0
- package/Sidebar/Drilldown.js +46 -0
- package/Sidebar/DrilldownMenu.d.ts +3 -0
- package/Sidebar/DrilldownMenu.js +55 -0
- package/Sidebar/DrilldownMenuItem.d.ts +3 -0
- package/Sidebar/DrilldownMenuItem.js +32 -0
- package/Sidebar/ExternalIcon.d.ts +4 -0
- package/Sidebar/ExternalIcon.js +29 -0
- package/Sidebar/Menu.d.ts +3 -0
- package/Sidebar/Menu.js +15 -0
- package/Sidebar/MenuContainer.d.ts +1 -0
- package/Sidebar/MenuContainer.js +13 -0
- package/Sidebar/MenuGroup.d.ts +9 -0
- package/Sidebar/MenuGroup.js +37 -0
- package/Sidebar/MenuItem.d.ts +3 -0
- package/Sidebar/MenuItem.js +34 -0
- package/Sidebar/MenuItemLabel.d.ts +5 -0
- package/Sidebar/MenuItemLabel.js +19 -0
- package/Sidebar/MenuLink.d.ts +5 -0
- package/Sidebar/MenuLink.js +16 -0
- package/Sidebar/MenuLinkItem.d.ts +3 -0
- package/Sidebar/MenuLinkItem.js +31 -0
- package/Sidebar/MobileSidebarButton.d.ts +5 -0
- package/Sidebar/MobileSidebarButton.js +21 -0
- package/Sidebar/Separator.d.ts +3 -0
- package/Sidebar/Separator.js +32 -0
- package/Sidebar/SeparatorItem.d.ts +5 -0
- package/Sidebar/SeparatorItem.js +14 -0
- package/Sidebar/SeparatorLine.d.ts +3 -0
- package/Sidebar/SeparatorLine.js +15 -0
- package/Sidebar/Sidebar.d.ts +8 -0
- package/Sidebar/Sidebar.js +24 -0
- package/Sidebar/SidebarLayout.d.ts +7 -0
- package/Sidebar/SidebarLayout.js +36 -0
- package/Sidebar/index.d.ts +19 -0
- package/Sidebar/index.js +35 -0
- package/Sidebar/types/DrilldownMenuProps.d.ts +6 -0
- package/Sidebar/types/DrilldownMenuProps.js +2 -0
- package/Sidebar/types/ItemState.d.ts +8 -0
- package/Sidebar/types/ItemState.js +2 -0
- package/Sidebar/types/MenuItemProps.d.ts +5 -0
- package/Sidebar/types/MenuItemProps.js +2 -0
- package/Sidebar/types/MenuStyle.d.ts +3 -0
- package/Sidebar/types/MenuStyle.js +8 -0
- package/Sidebar/types/NavItem.d.ts +26 -0
- package/Sidebar/types/NavItem.js +2 -0
- package/Sidebar/types/index.d.ts +5 -0
- package/Sidebar/types/index.js +21 -0
- package/SourceCode/SourceCode.js +2 -2
- package/TableOfContent/TableOfContent.d.ts +9 -0
- package/TableOfContent/TableOfContent.js +65 -0
- package/TableOfContent/index.d.ts +1 -0
- package/TableOfContent/index.js +17 -0
- package/globalStyle.js +1 -1
- package/hooks/index.d.ts +4 -0
- package/hooks/index.js +4 -0
- package/hooks/useActiveHeading.d.ts +2 -0
- package/hooks/useActiveHeading.js +34 -0
- package/hooks/useActiveSectionId.d.ts +3 -0
- package/hooks/useActiveSectionId.js +48 -0
- package/hooks/useFullHeight.d.ts +2 -0
- package/hooks/useFullHeight.js +47 -0
- package/hooks/useMobileMenu.d.ts +2 -0
- package/hooks/useMobileMenu.js +13 -0
- package/hooks/useNavbarHeight.d.ts +3 -0
- package/hooks/useNavbarHeight.js +20 -0
- package/icons/ShelfIcon/ShelfIcon.js +2 -2
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/mocks/hooks/usePageData.d.ts +5 -0
- package/mocks/hooks/usePageData.js +7 -0
- package/mocks/models.d.ts +3 -0
- package/mocks/models.js +2 -0
- package/mocks/search.d.ts +22 -0
- package/mocks/search.js +13 -0
- package/mocks/types/index.d.ts +1 -0
- package/mocks/types/index.js +2 -0
- package/mocks/usePreloadHistory.d.ts +3 -0
- package/mocks/usePreloadHistory.js +12 -0
- package/package.json +5 -2
- package/src/Button/Button.stories.tsx +1 -1
- package/src/Button/__tests__/Button.test.tsx +1 -1
- package/src/CodeBlock/__tests__/CodeBlock.test.tsx +1 -1
- package/src/CopyButton/CopyButton.stories.tsx +1 -1
- package/src/CopyButton/CopyButton.tsx +1 -1
- package/src/CopyButton/CopyButtonWrapper.tsx +4 -4
- package/src/CopyButton/__tests__/CopyButton.test.tsx +1 -1
- package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +2 -1
- package/src/Footer/Footer.tsx +34 -0
- package/src/Footer/FooterColumn.tsx +62 -0
- package/src/Footer/FooterColumns.tsx +51 -0
- package/src/Footer/FooterCopyright.tsx +26 -0
- package/src/Footer/index.ts +4 -0
- package/src/Headings/Headings.stories.tsx +1 -1
- package/src/Headings/Headings.ts +1 -1
- package/src/Headings/__tests__/Headings.test.tsx +1 -1
- package/src/JsonViewer/JsonViewer.stories.tsx +1 -1
- package/src/JsonViewer/JsonViewer.tsx +6 -7
- package/src/JsonViewer/__tests__/JsonViewer.test.tsx +2 -1
- package/src/JsonViewer/index.ts +1 -0
- package/src/Layout/PageLayout.tsx +34 -0
- package/src/Layout/RootLayout.tsx +24 -0
- package/src/Layout/index.ts +2 -0
- package/src/Logo/Logo.tsx +1 -7
- package/src/Logo/index.ts +1 -0
- package/src/Markdown/Admonition.tsx +64 -0
- package/src/Markdown/CodeSample/CodeSample.tsx +39 -0
- package/src/Markdown/CodeSample/index.ts +3 -0
- package/src/Markdown/CodeSample/styled.ts +289 -0
- package/src/Markdown/CodeSample/types.ts +40 -0
- package/src/Markdown/ContentWrapper.tsx +20 -0
- package/src/Markdown/Heading.tsx +35 -0
- package/src/Markdown/MarkdownLayout.tsx +25 -0
- package/src/Markdown/Mermaid.tsx +23 -0
- package/src/Markdown/PageWrapper.tsx +9 -0
- package/src/Markdown/StyledMarkdown.tsx +312 -0
- package/src/Markdown/Tabs/Tab.tsx +37 -0
- package/src/Markdown/Tabs/Tabs.tsx +45 -0
- package/src/Markdown/Tabs/index.ts +2 -0
- package/src/Markdown/index.ts +9 -0
- package/src/Navbar/Navbar.stories.tsx +3 -13
- package/src/Navbar/Navbar.tsx +20 -26
- package/src/Navbar/NavbarItem.tsx +2 -2
- package/src/Navbar/NavbarMenu.tsx +6 -6
- package/src/OperationBadge/OperationBadge.stories.tsx +35 -0
- package/src/OperationBadge/OperationBadge.ts +59 -0
- package/src/OperationBadge/__tests__/OperationBadge.test.tsx +59 -0
- package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +651 -0
- package/src/OperationBadge/index.ts +1 -0
- package/src/PageNavigation/NextPageLink.tsx +22 -0
- package/src/PageNavigation/PageNavigation.tsx +20 -0
- package/src/PageNavigation/PreviousPageLink.tsx +22 -0
- package/src/Panel/CodePanel.stories.tsx +1 -2
- package/src/Panel/CodePanel.ts +8 -7
- package/src/Panel/ContentPanel.stories.tsx +1 -2
- package/src/Panel/ContentPanel.ts +5 -6
- package/src/Panel/Panel.stories.tsx +1 -3
- package/src/Panel/Panel.ts +3 -3
- package/src/Panel/PanelComponent.tsx +4 -5
- package/src/Panel/__tests__/CodePanel.test.tsx +1 -1
- package/src/Panel/__tests__/ContentPanel.test.tsx +1 -1
- package/src/Panel/__tests__/Panel.test.tsx +1 -2
- package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +8 -8
- package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +22 -22
- package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +16 -16
- package/src/Panel/index.ts +1 -0
- package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +1 -1
- package/src/SamplesPanelControls/SamplesPanelControls.ts +1 -1
- package/src/Search/Autocomplete.tsx +128 -0
- package/src/Search/ClearIcon.tsx +31 -0
- package/src/Search/Input.tsx +19 -0
- package/src/Search/Parameters.tsx +62 -0
- package/src/Search/Popover.tsx +20 -0
- package/src/Search/Search.tsx +52 -0
- package/src/Search/SearchIcon.tsx +32 -0
- package/src/Search/SearchItem.tsx +85 -0
- package/src/Search/index.ts +9 -0
- package/src/Search/utils.tsx +19 -0
- package/src/Sidebar/ApiCallItem.tsx +33 -0
- package/src/Sidebar/ArrowBack.tsx +22 -0
- package/src/Sidebar/BackButton.tsx +44 -0
- package/src/Sidebar/Drilldown.tsx +46 -0
- package/src/Sidebar/DrilldownMenu.tsx +58 -0
- package/src/Sidebar/DrilldownMenuItem.tsx +40 -0
- package/src/Sidebar/ExternalIcon.tsx +37 -0
- package/src/Sidebar/Menu.tsx +11 -0
- package/src/Sidebar/MenuContainer.tsx +8 -0
- package/src/Sidebar/MenuGroup.tsx +55 -0
- package/src/Sidebar/MenuItem.tsx +25 -0
- package/src/Sidebar/MenuItemLabel.tsx +41 -0
- package/src/Sidebar/MenuLink.tsx +14 -0
- package/src/Sidebar/MenuLinkItem.tsx +24 -0
- package/src/Sidebar/MobileSidebarButton.tsx +44 -0
- package/src/Sidebar/Separator.tsx +17 -0
- package/src/Sidebar/SeparatorItem.tsx +14 -0
- package/src/Sidebar/SeparatorLine.tsx +9 -0
- package/src/Sidebar/Sidebar.tsx +54 -0
- package/src/Sidebar/SidebarLayout.tsx +30 -0
- package/src/Sidebar/index.ts +19 -0
- package/src/Sidebar/types/DrilldownMenuProps.ts +7 -0
- package/src/Sidebar/types/ItemState.ts +9 -0
- package/src/Sidebar/types/MenuItemProps.ts +6 -0
- package/src/Sidebar/types/MenuStyle.ts +4 -0
- package/src/Sidebar/types/NavItem.ts +27 -0
- package/src/Sidebar/types/index.ts +5 -0
- package/src/SidebarLogo/SidebarLogo.stories.tsx +1 -1
- package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +1 -1
- package/src/SourceCode/SourceCode.stories.tsx +1 -1
- package/src/SourceCode/SourceCode.tsx +7 -3
- package/src/SourceCode/__tests__/SourceCode.test.tsx +2 -1
- package/src/TableOfContent/TableOfContent.stories.tsx +39 -0
- package/src/TableOfContent/TableOfContent.tsx +112 -0
- package/src/TableOfContent/index.ts +1 -0
- package/src/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/Tooltip/Tooltip.tsx +1 -1
- package/src/Tooltip/__tests__/Tooltip.test.tsx +1 -1
- package/src/globalStyle.ts +10 -73
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useActiveHeading.ts +46 -0
- package/src/hooks/useActiveSectionId.ts +53 -0
- package/src/hooks/useFullHeight.ts +47 -0
- package/src/hooks/useMobileMenu.ts +11 -0
- package/src/hooks/useNavbarHeight.ts +24 -0
- package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +1 -1
- package/src/icons/ShelfIcon/ShelfIcon.tsx +1 -1
- package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/mocks/hooks/usePageData.ts +8 -0
- package/src/mocks/models.ts +3 -0
- package/src/mocks/search.ts +31 -0
- package/src/mocks/types/index.ts +1 -0
- package/src/mocks/usePreloadHistory.ts +9 -0
- package/src/types/portal/index.d.ts +6 -0
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +50 -0
- package/src/types/portal/src/client/app/media-css.d.ts +7 -0
- package/src/types/portal/src/client/styling/default.d.ts +407 -0
- package/src/types/portal/src/client/styling/index.d.ts +14 -0
- package/src/types/portal/src/client/styling/resolve.d.ts +1 -0
- package/src/types/portal/src/server/constants.d.ts +11 -0
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +28 -0
- package/src/types/portal/src/server/plugins/nav-utils.d.ts +19 -0
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +23 -0
- package/src/types/portal/src/server/plugins/sidebars/index.d.ts +16 -0
- package/src/types/portal/src/server/plugins/versions/index.d.ts +15 -0
- package/src/types/portal/src/server/plugins/versions/types.d.ts +23 -0
- package/src/types/portal/src/server/plugins/versions/utils.d.ts +10 -0
- package/src/types/portal/src/server/store.d.ts +101 -0
- package/src/types/portal/src/server/utils/async.d.ts +5 -0
- package/src/types/portal/src/server/utils/crypto.d.ts +3 -0
- package/src/types/portal/src/server/utils/fs.d.ts +3 -0
- package/src/types/portal/src/server/utils/index.d.ts +6 -0
- package/src/types/portal/src/server/utils/paths.d.ts +16 -0
- package/src/types/portal/src/server/utils/reporter/formatter.d.ts +11 -0
- package/src/types/portal/src/server/utils/reporter/reporter.d.ts +17 -0
- package/src/types/portal/src/server/utils/watcher.d.ts +16 -0
- package/src/types/portal/src/server/utils/yaml.d.ts +1 -0
- package/src/types/portal/src/shared/constants.d.ts +8 -0
- package/src/types/portal/src/shared/types.d.ts +77 -0
- package/src/types/portal/src/shared/urls.d.ts +7 -0
- package/src/types/portal/src/shared/utils.d.ts +10 -0
- package/src/ui/AlertIcon.tsx +110 -0
- package/src/ui/Arrow.tsx +36 -0
- package/src/ui/Background.tsx +16 -0
- package/src/ui/Box.tsx +39 -0
- package/src/ui/Button.tsx +19 -0
- package/src/ui/Dropdown.tsx +132 -0
- package/src/ui/Flex.tsx +21 -0
- package/src/ui/Jumbotron.tsx +57 -0
- package/src/ui/Tiles/ThinTile.tsx +151 -0
- package/src/ui/Tiles/TileHeader.ts +13 -0
- package/src/ui/Tiles/TileText.tsx +12 -0
- package/src/ui/Tiles/WideTile.tsx +138 -0
- package/src/ui/Tiles/index.ts +4 -0
- package/src/ui/Typography.tsx +167 -0
- package/src/ui/UniversalLink.tsx +100 -0
- package/src/ui/index.tsx +17 -0
- package/src/utils/__tests__/ClipboardService.test.ts +1 -1
- package/src/utils/__tests__/css-variables.test.ts +1 -1
- package/src/utils/__tests__/highlight.test.ts +1 -1
- package/src/utils/__tests__/jsonToHtml.test.ts +1 -1
- package/src/utils/__tests__/media-css.test.ts +1 -1
- package/src/utils/__tests__/theme-helpers.test.ts +1 -1
- package/src/utils/getNavbarElement.ts +10 -0
- package/src/utils/isUrl.ts +42 -0
- package/src/utils/replaceHashInColor.ts +3 -0
- package/ui/AlertIcon.d.ts +9 -0
- package/ui/AlertIcon.js +45 -0
- package/ui/Arrow.d.ts +7 -0
- package/ui/Arrow.js +42 -0
- package/ui/Background.d.ts +7 -0
- package/ui/Background.js +16 -0
- package/ui/Box.d.ts +6 -0
- package/ui/Box.js +16 -0
- package/ui/Button.d.ts +7 -0
- package/ui/Button.js +27 -0
- package/ui/Dropdown.d.ts +8 -0
- package/ui/Dropdown.js +55 -0
- package/ui/Flex.d.ts +10 -0
- package/ui/Flex.js +31 -0
- package/ui/Jumbotron.d.ts +18 -0
- package/ui/Jumbotron.js +44 -0
- package/ui/Tiles/ThinTile.d.ts +21 -0
- package/ui/Tiles/ThinTile.js +98 -0
- package/ui/Tiles/TileHeader.d.ts +5 -0
- package/ui/Tiles/TileHeader.js +15 -0
- package/ui/Tiles/TileText.d.ts +5 -0
- package/ui/Tiles/TileText.js +15 -0
- package/ui/Tiles/WideTile.d.ts +7 -0
- package/ui/Tiles/WideTile.js +93 -0
- package/ui/Tiles/index.d.ts +4 -0
- package/ui/Tiles/index.js +20 -0
- package/ui/Typography.d.ts +110 -0
- package/ui/Typography.js +137 -0
- package/ui/UniversalLink.d.ts +17 -0
- package/ui/UniversalLink.js +62 -0
- package/ui/index.d.ts +14 -0
- package/ui/index.js +34 -0
- package/utils/getNavbarElement.d.ts +1 -0
- package/utils/getNavbarElement.js +14 -0
- package/utils/isUrl.d.ts +12 -0
- package/utils/isUrl.js +36 -0
- package/utils/replaceHashInColor.d.ts +1 -0
- package/utils/replaceHashInColor.js +7 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { OperationBadge } from '@theme/OperationBadge';
|
|
5
|
+
import { Link } from '@portal/Link';
|
|
6
|
+
import { ActiveItem, SearchDocument } from '@shared/models';
|
|
7
|
+
import { Parameters } from '@theme/Search/Parameters';
|
|
8
|
+
import { highlight } from '@theme/Search/utils';
|
|
9
|
+
|
|
10
|
+
interface SearchItemProps {
|
|
11
|
+
item: ActiveItem<SearchDocument>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function SearchItem({ item }: SearchItemProps): JSX.Element {
|
|
15
|
+
const ref = useRef<HTMLAnchorElement>();
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (item.active) {
|
|
19
|
+
ref.current?.focus();
|
|
20
|
+
}
|
|
21
|
+
}, [item.active]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<SearchLink to={item.url} tabIndex={0} innerRef={ref} data-component-name="Search/SearchItem">
|
|
25
|
+
{item.httpVerb ? (
|
|
26
|
+
<Operation>
|
|
27
|
+
<OperationBadge type={item.httpVerb}>{item.httpVerb}</OperationBadge>
|
|
28
|
+
{highlight(item.pathName)}
|
|
29
|
+
</Operation>
|
|
30
|
+
) : null}
|
|
31
|
+
<Title>{highlight(item.title)}</Title>
|
|
32
|
+
<Description>{highlight(item.text)}</Description>
|
|
33
|
+
|
|
34
|
+
{item.parameters?.length ? (
|
|
35
|
+
<Parameters parameters={item.parameters} />
|
|
36
|
+
) : (
|
|
37
|
+
<Path>{item.path?.join(' → ')}</Path>
|
|
38
|
+
)}
|
|
39
|
+
</SearchLink>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const SearchLink = styled(Link)`
|
|
44
|
+
display: block;
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
padding: 8px 24px;
|
|
47
|
+
transition: background-color 0.3s ease;
|
|
48
|
+
outline: none;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
color: var(--search-item-text-color);
|
|
51
|
+
|
|
52
|
+
&:hover,
|
|
53
|
+
&:focus {
|
|
54
|
+
background-color: var(--search-item-active-background-color);
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const Operation = styled.div`
|
|
59
|
+
font-weight: var(--font-weight-light);
|
|
60
|
+
font-size: var(--font-size-small);
|
|
61
|
+
color: var(--search-item-title-text-color);
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
text-overflow: ellipsis;
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
const Title = styled.div`
|
|
67
|
+
font-weight: var(--font-weight-bold);
|
|
68
|
+
color: var(--search-item-title-text-color);
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
line-height: var(--line-height-m);
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const Description = styled.div`
|
|
75
|
+
font-size: var(--font-size-base);
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
const Path = styled.div`
|
|
81
|
+
font-size: var(--font-size-small);
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
line-height: 22px;
|
|
85
|
+
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './Autocomplete';
|
|
2
|
+
export * from './ClearIcon';
|
|
3
|
+
export * from './Input';
|
|
4
|
+
export * from './Parameters';
|
|
5
|
+
export * from './Popover';
|
|
6
|
+
export * from './Search';
|
|
7
|
+
export * from './SearchIcon';
|
|
8
|
+
export * from './SearchItem';
|
|
9
|
+
export * from './utils';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export const highlight = (text: string | string[]): JSX.Element | string => {
|
|
5
|
+
if (!Array.isArray(text)) return text;
|
|
6
|
+
|
|
7
|
+
const [pre, entry, suf] = text;
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{pre}
|
|
11
|
+
<Strong>{entry}</Strong>
|
|
12
|
+
{suf}
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Strong = styled.strong`
|
|
18
|
+
color: var(--color-primary-main);
|
|
19
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { OperationBadge } from '@theme/OperationBadge';
|
|
5
|
+
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
6
|
+
import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
|
|
7
|
+
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
8
|
+
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
9
|
+
|
|
10
|
+
export function ApiCallItem({ item }: MenuItemProps): JSX.Element {
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper data-component-name="Sidebar/ApiCallItem">
|
|
13
|
+
<MenuLinkItem item={item}>
|
|
14
|
+
<MenuItemLabel active={item.active}>
|
|
15
|
+
{/* TODO: not sure item.httpVerb || 'event' is correct */}
|
|
16
|
+
<Badge type={item.httpVerb || 'event'}>
|
|
17
|
+
{item.httpVerb === 'hook' ? 'event' : item.httpVerb}
|
|
18
|
+
</Badge>
|
|
19
|
+
{item.label}
|
|
20
|
+
</MenuItemLabel>
|
|
21
|
+
</MenuLinkItem>
|
|
22
|
+
|
|
23
|
+
{item.separatorLine ? <SeparatorLine /> : null}
|
|
24
|
+
</Wrapper>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Wrapper = styled.div``;
|
|
29
|
+
|
|
30
|
+
export const Badge = styled(OperationBadge)`
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
margin-top: 0;
|
|
33
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Arrow = ({ className }: { className?: string }): JSX.Element => (
|
|
5
|
+
<span data-component-name="Sidebar/ArrowBack">
|
|
6
|
+
<svg
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
viewBox="0 0 12 10"
|
|
10
|
+
width="12px"
|
|
11
|
+
height="10px"
|
|
12
|
+
className={className}
|
|
13
|
+
>
|
|
14
|
+
<path d="M2.414 5l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L2.414 5z" />
|
|
15
|
+
<path d="M2 5a1 1 0 011-1h8a1 1 0 110 2H3a1 1 0 01-1-1z" />
|
|
16
|
+
</svg>
|
|
17
|
+
</span>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const ArrowBack = styled(Arrow)`
|
|
21
|
+
fill: var(--sidebar-chevron-color);
|
|
22
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { ArrowBack } from '@theme/Sidebar/ArrowBack';
|
|
5
|
+
|
|
6
|
+
interface BackButtonProps {
|
|
7
|
+
back: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function BackButton({
|
|
11
|
+
children,
|
|
12
|
+
back,
|
|
13
|
+
}: React.PropsWithChildren<BackButtonProps>): JSX.Element {
|
|
14
|
+
return (
|
|
15
|
+
<Button onClick={back} data-component-name="Sidebar/BackButton">
|
|
16
|
+
<ArrowBack />
|
|
17
|
+
{children}
|
|
18
|
+
</Button>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Button = styled.button`
|
|
23
|
+
width: 100%;
|
|
24
|
+
background-color: transparent;
|
|
25
|
+
padding: 0;
|
|
26
|
+
border: 0;
|
|
27
|
+
outline: 0;
|
|
28
|
+
color: var(--color-secondary-contrast);
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
font-size: var(--sidebar-font-size);
|
|
33
|
+
transition: color 0.25s ease;
|
|
34
|
+
text-align: left;
|
|
35
|
+
margin-bottom: calc(var(--sidebar-spacing-padding-vertical) * 3);
|
|
36
|
+
|
|
37
|
+
svg {
|
|
38
|
+
margin-right: calc(var(--sidebar-spacing-unit) * 1.5);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
color: var(--sidebar-text-color);
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
5
|
+
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
6
|
+
import { DrilldownMenuItem } from '@theme/Sidebar/DrilldownMenuItem';
|
|
7
|
+
import { DrilldownMenu } from '@theme/Sidebar/DrilldownMenu';
|
|
8
|
+
import { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
9
|
+
|
|
10
|
+
interface DrilldownProps extends DrilldownMenuProps {
|
|
11
|
+
isExpanded: boolean;
|
|
12
|
+
expand: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Drilldown({
|
|
16
|
+
isExpanded,
|
|
17
|
+
item,
|
|
18
|
+
expand,
|
|
19
|
+
...props
|
|
20
|
+
}: React.PropsWithChildren<DrilldownProps>): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<Wrapper data-component-name="Sidebar/Drilldown">
|
|
23
|
+
<DrilldownLabel onClick={expand}>
|
|
24
|
+
<DrilldownMenuItem item={item} />
|
|
25
|
+
</DrilldownLabel>
|
|
26
|
+
|
|
27
|
+
{isExpanded ? <DrilldownMenu item={item} {...props} /> : null}
|
|
28
|
+
|
|
29
|
+
{item.separatorLine ? <SeparatorLine /> : null}
|
|
30
|
+
</Wrapper>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const Wrapper = styled.div``;
|
|
35
|
+
|
|
36
|
+
const DrilldownLabel = styled(MenuItemLabel)`
|
|
37
|
+
padding-top: calc(var(--sidebar-spacing-padding-vertical) * 2);
|
|
38
|
+
padding-bottom: calc(var(--sidebar-spacing-padding-vertical) * 2);
|
|
39
|
+
padding-left: var(--sidebar-spacing-padding-horizontal);
|
|
40
|
+
font-weight: var(--font-weight-bold);
|
|
41
|
+
|
|
42
|
+
&:hover {
|
|
43
|
+
color: initial;
|
|
44
|
+
background-color: initial;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
5
|
+
import { BackButton } from '@theme/Sidebar/BackButton';
|
|
6
|
+
import { DrilldownMenuItem } from '@theme/Sidebar/DrilldownMenuItem';
|
|
7
|
+
|
|
8
|
+
export function DrilldownMenu({
|
|
9
|
+
item,
|
|
10
|
+
back,
|
|
11
|
+
prevActiveItem,
|
|
12
|
+
children,
|
|
13
|
+
}: React.PropsWithChildren<DrilldownMenuProps>): JSX.Element {
|
|
14
|
+
return (
|
|
15
|
+
<MenuContainer data-component-name="Sidebar/DrilldownMenu">
|
|
16
|
+
<MenuContent>
|
|
17
|
+
<MenuWrapper>
|
|
18
|
+
<BackButton back={back}>{prevActiveItem?.label || 'Back'}</BackButton>
|
|
19
|
+
<DrilldownMenuItem item={item} />
|
|
20
|
+
</MenuWrapper>
|
|
21
|
+
|
|
22
|
+
{children}
|
|
23
|
+
</MenuContent>
|
|
24
|
+
</MenuContainer>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const MenuContainer = styled.div`
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
bottom: 0;
|
|
32
|
+
width: 100%;
|
|
33
|
+
z-index: 100;
|
|
34
|
+
background-color: var(--sidebar-background-color);
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const slideInAnimation = keyframes`
|
|
38
|
+
0% {
|
|
39
|
+
transform: translateX(100%)
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
transform: translateX(0%)
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const MenuContent = styled.div`
|
|
47
|
+
animation-name: ${slideInAnimation};
|
|
48
|
+
animation-fill-mode: forwards;
|
|
49
|
+
animation-duration: 0.3s;
|
|
50
|
+
animation-timing-function: ease;
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const MenuWrapper = styled.div`
|
|
55
|
+
padding: var(--sidebar-spacing-padding-vertical) var(--sidebar-spacing-padding-horizontal);
|
|
56
|
+
margin-bottom: calc(var(--sidebar-spacing-unit) * 3);
|
|
57
|
+
word-break: break-word;
|
|
58
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
|
|
6
|
+
export function DrilldownMenuItem({ item }: MenuItemProps): JSX.Element {
|
|
7
|
+
return (
|
|
8
|
+
<Container data-component-name="Sidebar/DrilldownMenuItem">
|
|
9
|
+
{item.icon ? <Icon src={item.icon} /> : null}
|
|
10
|
+
<div>
|
|
11
|
+
{item.label}
|
|
12
|
+
{item.sublabel ? <Sublabel>{item.sublabel}</Sublabel> : null}
|
|
13
|
+
</div>
|
|
14
|
+
</Container>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Container = styled.div`
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
color: var(--sidebar-text-color);
|
|
22
|
+
font-size: var(--sidebar-font-size);
|
|
23
|
+
font-weight: var(--font-weight-bold);
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const Icon = styled.img`
|
|
27
|
+
width: calc(var(--sidebar-spacing-unit) * 4);
|
|
28
|
+
height: calc(var(--sidebar-spacing-unit) * 4);
|
|
29
|
+
margin-right: var(--sidebar-spacing-unit);
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
const Sublabel = styled.div`
|
|
36
|
+
margin-top: 2px;
|
|
37
|
+
font-size: 0.85rem;
|
|
38
|
+
color: var(--color-secondary-contrast);
|
|
39
|
+
font-weight: var(--font-weight-regular);
|
|
40
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Icon = ({ className }: { className?: string }): JSX.Element => (
|
|
5
|
+
<span data-component-name="Sidebar/ExternalIcon">
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
version="1.1"
|
|
9
|
+
x="0px"
|
|
10
|
+
y="0px"
|
|
11
|
+
viewBox="0 0 100 125"
|
|
12
|
+
enableBackground="new 0 0 100 100"
|
|
13
|
+
className={className}
|
|
14
|
+
>
|
|
15
|
+
<path d="M-408.167-318.5" />
|
|
16
|
+
<line
|
|
17
|
+
fill="none"
|
|
18
|
+
stroke="#ffffff"
|
|
19
|
+
strokeWidth="0.25"
|
|
20
|
+
strokeMiterlimit="10"
|
|
21
|
+
x1="57.5"
|
|
22
|
+
y1="11.75"
|
|
23
|
+
x2="57.5"
|
|
24
|
+
y2="17.5"
|
|
25
|
+
/>
|
|
26
|
+
<path d="M98.57,4.784c-0.024-0.113-0.047-0.223-0.074-0.334c-0.035-0.117-0.075-0.231-0.117-0.346 c-0.023-0.062-0.037-0.125-0.064-0.187c-0.016-0.032-0.03-0.06-0.049-0.092c-0.048-0.119-0.107-0.227-0.17-0.336 c-0.05-0.089-0.095-0.179-0.152-0.265c-0.062-0.1-0.139-0.195-0.209-0.292C97.67,2.85,97.611,2.77,97.545,2.69 c-0.081-0.092-0.172-0.178-0.258-0.262c-0.07-0.068-0.139-0.139-0.212-0.202c-0.093-0.083-0.196-0.158-0.3-0.232 c-0.08-0.058-0.152-0.114-0.236-0.163c-0.104-0.069-0.219-0.128-0.329-0.186c-0.091-0.046-0.175-0.093-0.262-0.132 c-0.044-0.019-0.081-0.043-0.121-0.061c-0.074-0.03-0.154-0.046-0.234-0.072c-0.095-0.033-0.19-0.065-0.288-0.092 c-0.123-0.034-0.246-0.059-0.369-0.083c-0.096-0.019-0.188-0.036-0.289-0.046c-0.131-0.018-0.263-0.022-0.393-0.028 c-0.064-0.002-0.12-0.012-0.186-0.012L63.77,1.305c-2.535,0.017-4.566,2.078-4.554,4.605c0.019,2.525,2.084,4.563,4.604,4.546 l19.258-0.121l-29.79,30.162c-1.112,1.126-1.526,2.678-1.233,4.118c0.174,0.863,0.596,1.691,1.272,2.357 c0.897,0.888,2.073,1.325,3.245,1.32c1.17-0.007,2.337-0.459,3.227-1.361l0.002-0.001l29.787-30.158l0.121,19.255 c0.014,2.523,2.07,4.564,4.602,4.545c1.268-0.005,2.408-0.526,3.233-1.357c0.817-0.834,1.325-1.98,1.317-3.242L98.675,5.665 c0-0.063-0.016-0.124-0.016-0.189c-0.009-0.123-0.015-0.25-0.032-0.375C98.616,4.992,98.592,4.89,98.57,4.784z" />
|
|
27
|
+
<path d="M6.542,83.279c0,5.717,4.635,10.354,10.354,10.354l55.616,0.065c5.719,0,10.354-4.636,10.354-10.354l-0.091-40.782h6.135 v40.849c0,9.014-7.307,16.319-16.319,16.319l-56.36-0.066c-8.597,0-15.564-6.969-15.564-15.562L0.585,27.821 c0-9.014,7.306-16.32,16.32-16.32l41.138-0.084v6.142L16.98,17.535c-5.718,0-10.354,4.635-10.354,10.354L6.542,83.279z" />
|
|
28
|
+
</svg>
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const ExternalIcon = styled(Icon)`
|
|
33
|
+
width: 10px;
|
|
34
|
+
height: 10px;
|
|
35
|
+
margin-left: 5px;
|
|
36
|
+
fill: var(--sidebar-chevron-color);
|
|
37
|
+
`;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Arrow } from '@theme/ui/Arrow';
|
|
5
|
+
import { ItemState } from '@theme/Sidebar/types/ItemState';
|
|
6
|
+
import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
|
|
7
|
+
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
8
|
+
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
9
|
+
|
|
10
|
+
interface MenuGroupProps {
|
|
11
|
+
item: ItemState;
|
|
12
|
+
isExpanded: boolean;
|
|
13
|
+
toggleExpanded: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function MenuGroup({
|
|
17
|
+
item,
|
|
18
|
+
isExpanded,
|
|
19
|
+
toggleExpanded,
|
|
20
|
+
children,
|
|
21
|
+
}: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
|
|
22
|
+
return (
|
|
23
|
+
<Wrapper data-component-name="Sidebar/MenuGroup">
|
|
24
|
+
<MenuLinkItem item={item}>
|
|
25
|
+
<MenuGroupLabel
|
|
26
|
+
onClick={toggleExpanded}
|
|
27
|
+
isAlwaysExpanded={item.expanded === 'always'}
|
|
28
|
+
active={item.active}
|
|
29
|
+
>
|
|
30
|
+
<MenuGroupArrow direction={isExpanded ? 'down' : 'right'} />
|
|
31
|
+
{item.label}
|
|
32
|
+
</MenuGroupLabel>
|
|
33
|
+
</MenuLinkItem>
|
|
34
|
+
|
|
35
|
+
<MenuWrapper>{isExpanded ? children : null}</MenuWrapper>
|
|
36
|
+
|
|
37
|
+
{item.separatorLine ? <SeparatorLine /> : null}
|
|
38
|
+
</Wrapper>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Wrapper = styled.div``;
|
|
43
|
+
|
|
44
|
+
const MenuWrapper = styled.div`
|
|
45
|
+
padding-left: var(--sidebar-spacing-offset-nesting);
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const MenuGroupLabel = styled(MenuItemLabel)<{ isAlwaysExpanded?: boolean }>`
|
|
49
|
+
padding-left: var(--sidebar-spacing-padding-horizontal);
|
|
50
|
+
cursor: ${(props) => (props.isAlwaysExpanded ? 'default' : 'pointer')};
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const MenuGroupArrow = styled(Arrow)`
|
|
54
|
+
margin-right: calc(var(--sidebar-spacing-unit) / 2);
|
|
55
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
|
|
6
|
+
import { ExternalIcon } from '@theme/Sidebar/ExternalIcon';
|
|
7
|
+
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
8
|
+
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
9
|
+
|
|
10
|
+
export function MenuItem({ item }: MenuItemProps): JSX.Element {
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper data-component-name="Sidebar/MenuItem">
|
|
13
|
+
<MenuLinkItem item={item}>
|
|
14
|
+
<MenuItemLabel active={item.active}>
|
|
15
|
+
{item.label}
|
|
16
|
+
{item.external ? <ExternalIcon /> : null}
|
|
17
|
+
</MenuItemLabel>
|
|
18
|
+
</MenuLinkItem>
|
|
19
|
+
|
|
20
|
+
{item.separatorLine ? <SeparatorLine /> : null}
|
|
21
|
+
</Wrapper>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Wrapper = styled.div``;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const MenuItemLabel = styled.li.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Sidebar/MenuItemLabel',
|
|
5
|
+
}))<{ active?: boolean }>`
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
transition: background-color 0.3s, color 0.3s;
|
|
10
|
+
word-break: break-word;
|
|
11
|
+
margin-bottom: 1px;
|
|
12
|
+
|
|
13
|
+
font-family: var(--sidebar-font-family);
|
|
14
|
+
font-size: var(--sidebar-font-size);
|
|
15
|
+
font-weight: var(--font-weight-regular);
|
|
16
|
+
margin-left: var(--sidebar-spacing-offset-left);
|
|
17
|
+
padding: var(--sidebar-spacing-padding-vertical) var(--sidebar-spacing-padding-horizontal);
|
|
18
|
+
padding-left: calc(
|
|
19
|
+
var(--sidebar-spacing-padding-horizontal) + var(--sidebar-chevron-size) +
|
|
20
|
+
var(--sidebar-spacing-unit) * 0.5
|
|
21
|
+
);
|
|
22
|
+
border-top-left-radius: var(--sidebar-border-radius);
|
|
23
|
+
border-bottom-left-radius: var(--sidebar-border-radius);
|
|
24
|
+
|
|
25
|
+
${(props) =>
|
|
26
|
+
props.active
|
|
27
|
+
? `
|
|
28
|
+
color: var(--sidebar-text-active-color);
|
|
29
|
+
background-color: var(--sidebar-text-active-background-color);
|
|
30
|
+
`
|
|
31
|
+
: null};
|
|
32
|
+
|
|
33
|
+
:hover {
|
|
34
|
+
color: var(--sidebar-text-active-color);
|
|
35
|
+
background-color: var(--sidebar-text-active-background-color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:empty {
|
|
39
|
+
padding: 0;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { UniversalLink, UniversalLinkProps } from '@theme/ui/UniversalLink';
|
|
4
|
+
|
|
5
|
+
export const MenuLink = styled(UniversalLink).attrs(() => ({
|
|
6
|
+
'data-component-name': 'Sidebar/MenuLink',
|
|
7
|
+
}))<UniversalLinkProps>`
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
color: var(--sidebar-text-color);
|
|
10
|
+
|
|
11
|
+
&&.external-url:after {
|
|
12
|
+
content: none;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { MenuLink } from '@theme/Sidebar/MenuLink';
|
|
5
|
+
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
6
|
+
|
|
7
|
+
export function MenuLinkItem({
|
|
8
|
+
item,
|
|
9
|
+
children,
|
|
10
|
+
}: React.PropsWithChildren<MenuItemProps>): JSX.Element {
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper data-component-name="Sidebar/MenuLinkItem">
|
|
13
|
+
{item.link ? (
|
|
14
|
+
<MenuLink to={item.link} {...item}>
|
|
15
|
+
{children}
|
|
16
|
+
</MenuLink>
|
|
17
|
+
) : (
|
|
18
|
+
children
|
|
19
|
+
)}
|
|
20
|
+
</Wrapper>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Wrapper = styled.span``;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const MobileSidebarButton = styled.span.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Sidebar/MobileSidebarButton',
|
|
5
|
+
}))<{ opened?: boolean }>`
|
|
6
|
+
background-color: var(--color-primary-500);
|
|
7
|
+
width: 55px;
|
|
8
|
+
user-select: none;
|
|
9
|
+
height: 55px;
|
|
10
|
+
bottom: 44px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
position: fixed;
|
|
13
|
+
right: 20px;
|
|
14
|
+
z-index: 3;
|
|
15
|
+
box-shadow: rgba(0, 0, 0, 0.3) 0px 0px 20px;
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
transform: ${(props) => (props.opened ? 'rotate(180deg)' : 'rotate(0deg)')};
|
|
18
|
+
transition: transform 0.75s;
|
|
19
|
+
|
|
20
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
21
|
+
display: none;
|
|
22
|
+
transform: rotate(180deg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${({ theme }) => theme.mediaQueries.print} {
|
|
26
|
+
display: none !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:after {
|
|
30
|
+
content: '';
|
|
31
|
+
display: inline-block;
|
|
32
|
+
position: absolute;
|
|
33
|
+
transform: translate(-50%, -50%);
|
|
34
|
+
top: 50%;
|
|
35
|
+
left: 50%;
|
|
36
|
+
width: 25px;
|
|
37
|
+
height: 25px;
|
|
38
|
+
background-color: var(--color-primary-contrast);
|
|
39
|
+
-webkit-mask: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 294.842 294.842' style='enable-background:new 0 0 294.842 294.842;' xml:space='preserve'%3E%3Cg%3E%3Cpath fill='%23fff' d='M292.128,214.846c-2.342-2.344-6.143-2.344-8.484,0l-59.512,59.511V6c0-3.313-2.687-6-6-6s-6,2.687-6,6v268.356 l-59.513-59.512c-2.342-2.342-6.142-2.343-8.485,0.001c-2.343,2.343-2.343,6.142,0.001,8.485l69.755,69.754 c1.171,1.171,2.707,1.757,4.242,1.757s3.071-0.586,4.242-1.758l69.754-69.754C294.472,220.987,294.472,217.188,292.128,214.846z'/%3E%3Cpath fill='%23fff' d='M6.956,12h180.137c3.313,0,6-2.687,6-6s-2.687-6-6-6H6.956c-3.313,0-6,2.687-6,6S3.643,12,6.956,12z'/%3E%3Cpath fill='%23fff' d='M6.956,82.228h180.137c3.313,0,6-2.687,6-6s-2.687-6-6-6H6.956c-3.313,0-6,2.687-6,6S3.643,82.228,6.956,82.228z'/%3E%3Cpath fill='%23fff' d='M6.956,152.456h180.137c3.313,0,6-2.687,6-6s-2.687-6-6-6H6.956c-3.313,0-6,2.687-6,6S3.643,152.456,6.956,152.456z'/%3E%3Cpath fill='%23fff' d='M124.438,210.685H6.956c-3.313,0-6,2.687-6,6s2.687,6,6,6h117.482c3.313,0,6-2.687,6-6S127.752,210.685,124.438,210.685z' /%3E%3Cpath fill='%23fff' d='M124.438,280.912H6.956c-3.313,0-6,2.687-6,6s2.687,6,6,6h117.482c3.313,0,6-2.687,6-6S127.752,280.912,124.438,280.912z' /%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A")
|
|
40
|
+
no-repeat 50% 50%;
|
|
41
|
+
mask: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 294.842 294.842' style='enable-background:new 0 0 294.842 294.842;' xml:space='preserve'%3E%3Cg%3E%3Cpath fill='%23fff' d='M292.128,214.846c-2.342-2.344-6.143-2.344-8.484,0l-59.512,59.511V6c0-3.313-2.687-6-6-6s-6,2.687-6,6v268.356 l-59.513-59.512c-2.342-2.342-6.142-2.343-8.485,0.001c-2.343,2.343-2.343,6.142,0.001,8.485l69.755,69.754 c1.171,1.171,2.707,1.757,4.242,1.757s3.071-0.586,4.242-1.758l69.754-69.754C294.472,220.987,294.472,217.188,292.128,214.846z'/%3E%3Cpath fill='%23fff' d='M6.956,12h180.137c3.313,0,6-2.687,6-6s-2.687-6-6-6H6.956c-3.313,0-6,2.687-6,6S3.643,12,6.956,12z'/%3E%3Cpath fill='%23fff' d='M6.956,82.228h180.137c3.313,0,6-2.687,6-6s-2.687-6-6-6H6.956c-3.313,0-6,2.687-6,6S3.643,82.228,6.956,82.228z'/%3E%3Cpath fill='%23fff' d='M6.956,152.456h180.137c3.313,0,6-2.687,6-6s-2.687-6-6-6H6.956c-3.313,0-6,2.687-6,6S3.643,152.456,6.956,152.456z'/%3E%3Cpath fill='%23fff' d='M124.438,210.685H6.956c-3.313,0-6,2.687-6,6s2.687,6,6,6h117.482c3.313,0,6-2.687,6-6S127.752,210.685,124.438,210.685z' /%3E%3Cpath fill='%23fff' d='M124.438,280.912H6.956c-3.313,0-6,2.687-6,6s2.687,6,6,6h117.482c3.313,0,6-2.687,6-6S127.752,280.912,124.438,280.912z' /%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A")
|
|
42
|
+
no-repeat 50% 50%;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
|
+
import { SeparatorLine } from '@theme/Sidebar/SeparatorLine';
|
|
6
|
+
import { SeparatorItem } from '@theme/Sidebar/SeparatorItem';
|
|
7
|
+
|
|
8
|
+
export function Separator({ item }: MenuItemProps): JSX.Element {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper data-component-name="Sidebar/Separator">
|
|
11
|
+
<SeparatorItem>{item.label}</SeparatorItem>
|
|
12
|
+
{item.separatorLine ? <SeparatorLine /> : null}
|
|
13
|
+
</Wrapper>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Wrapper = styled.div``;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
4
|
+
|
|
5
|
+
export const SeparatorItem = styled(MenuItemLabel)`
|
|
6
|
+
cursor: default;
|
|
7
|
+
font-weight: var(--font-weight-bold);
|
|
8
|
+
color: var(--sidebar-separator-label-color);
|
|
9
|
+
|
|
10
|
+
:hover {
|
|
11
|
+
color: inherit;
|
|
12
|
+
background-color: inherit;
|
|
13
|
+
}
|
|
14
|
+
`;
|