@redocly/theme 0.1.5 → 0.1.8
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 +34 -0
- package/Footer/FooterColumn.d.ts +7 -0
- package/Footer/FooterColumn.js +38 -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 +29 -0
- package/Footer/index.d.ts +4 -0
- package/Footer/index.js +14 -0
- package/JsonViewer/JsonViewer.js +1 -1
- package/JsonViewer/index.d.ts +1 -0
- package/JsonViewer/index.js +1 -0
- package/LICENSE +1 -0
- package/Layout/PageLayout.d.ts +6 -0
- package/Layout/PageLayout.js +30 -0
- package/Layout/RootLayout.d.ts +7 -0
- package/Layout/RootLayout.js +31 -0
- package/Layout/index.d.ts +2 -0
- package/Layout/index.js +10 -0
- package/Logo/Logo.d.ts +1 -6
- package/Markdown/Admonition/Admonition.d.ts +9 -0
- package/Markdown/Admonition/Admonition.js +39 -0
- package/Markdown/CodeSample/CodeSample.d.ts +8 -0
- package/Markdown/CodeSample/CodeSample.js +30 -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/Heading.d.ts +5 -0
- package/Markdown/Heading/Heading.js +23 -0
- package/Markdown/MarkdownLayout.d.ts +7 -0
- package/Markdown/MarkdownLayout.js +23 -0
- package/Markdown/Mermaid/Mermaid.d.ts +6 -0
- package/Markdown/Mermaid/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/Navbar/Navbar.d.ts +1 -0
- package/Navbar/Navbar.js +7 -1
- package/Navbar/NavbarItem.js +1 -1
- package/Navbar/NavbarMenu.js +4 -1
- 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/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 +5 -0
- package/Sidebar/ArrowBack.js +28 -0
- package/Sidebar/BackButton.d.ts +6 -0
- package/Sidebar/BackButton.js +30 -0
- package/Sidebar/Drilldown.d.ts +8 -0
- package/Sidebar/Drilldown.js +45 -0
- package/Sidebar/DrilldownMenu.d.ts +3 -0
- package/Sidebar/DrilldownMenu.js +57 -0
- package/Sidebar/DrilldownMenuItem.d.ts +3 -0
- package/Sidebar/DrilldownMenuItem.js +31 -0
- package/Sidebar/ExternalIcon.d.ts +5 -0
- package/Sidebar/ExternalIcon.js +28 -0
- package/Sidebar/Menu.d.ts +4 -0
- package/Sidebar/Menu.js +14 -0
- package/Sidebar/MenuContainer.d.ts +2 -0
- package/Sidebar/MenuContainer.js +12 -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 +33 -0
- package/Sidebar/MenuItemLabel.d.ts +6 -0
- package/Sidebar/MenuItemLabel.js +18 -0
- package/Sidebar/MenuLink.d.ts +6 -0
- package/Sidebar/MenuLink.js +15 -0
- package/Sidebar/MenuLinkItem.d.ts +3 -0
- package/Sidebar/MenuLinkItem.js +30 -0
- package/Sidebar/MobileSidebarButton.d.ts +6 -0
- package/Sidebar/MobileSidebarButton.js +20 -0
- package/Sidebar/Separator.d.ts +3 -0
- package/Sidebar/Separator.js +31 -0
- package/Sidebar/SeparatorItem.d.ts +6 -0
- package/Sidebar/SeparatorItem.js +13 -0
- package/Sidebar/SeparatorLine.d.ts +4 -0
- package/Sidebar/SeparatorLine.js +14 -0
- package/Sidebar/Sidebar.d.ts +8 -0
- package/Sidebar/Sidebar.js +23 -0
- package/Sidebar/SidebarLayout.d.ts +7 -0
- package/Sidebar/SidebarLayout.js +35 -0
- package/Sidebar/types/DrilldownMenuProps.d.ts +6 -0
- package/Sidebar/types/DrilldownMenuProps.js +2 -0
- package/Sidebar/types/ItemState.d.ts +9 -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/SourceCode/SourceCode.js +2 -2
- package/TableOfContent/TableOfContent.d.ts +9 -0
- package/TableOfContent/TableOfContent.js +64 -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 +1 -0
- package/index.js +1 -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 +6 -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.tsx +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.tsx +2 -0
- package/src/Logo/Logo.tsx +1 -7
- package/src/Markdown/Admonition/Admonition.tsx +64 -0
- package/src/Markdown/CodeSample/CodeSample.tsx +39 -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/Heading.tsx +35 -0
- package/src/Markdown/MarkdownLayout.tsx +25 -0
- package/src/Markdown/Mermaid/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/Navbar/Navbar.stories.tsx +1 -11
- package/src/Navbar/Navbar.tsx +19 -25
- package/src/Navbar/NavbarItem.tsx +1 -1
- package/src/Navbar/NavbarMenu.tsx +4 -4
- 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/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/types/DrilldownMenuProps.ts +7 -0
- package/src/Sidebar/types/ItemState.ts +11 -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/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.tsx +112 -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 +1 -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/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/Typography.tsx +167 -0
- package/src/ui/UniversalLink.tsx +100 -0
- package/src/ui/index.tsx +12 -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/Arrow.d.ts +7 -0
- package/ui/Arrow/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 +54 -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/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 +10 -0
- package/ui/index.js +30 -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 +35 -0
- package/utils/replaceHashInColor.d.ts +1 -0
- package/utils/replaceHashInColor.js +6 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import styled, { css, FlattenSimpleInterpolation } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { typography, typographyTokens, ITypography } from '@theme/ui/Typography';
|
|
4
|
+
|
|
5
|
+
export const baseTable = css`
|
|
6
|
+
table {
|
|
7
|
+
display: block;
|
|
8
|
+
width: 100%;
|
|
9
|
+
overflow: auto;
|
|
10
|
+
word-break: keep-all;
|
|
11
|
+
border-collapse: separate;
|
|
12
|
+
border-spacing: 0;
|
|
13
|
+
margin-top: 20px;
|
|
14
|
+
margin-bottom: 20px;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
table th,
|
|
19
|
+
table td {
|
|
20
|
+
padding: 12px;
|
|
21
|
+
border-bottom: 1px solid var(--color-border-light);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
table th {
|
|
25
|
+
text-align: left;
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
background-color: var(--color-secondary-300);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
table tr th:first-child,
|
|
31
|
+
table tr td:first-child {
|
|
32
|
+
border-left: 1px solid var(--color-border-light);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
table tr td:last-child,
|
|
36
|
+
table tr th:last-child {
|
|
37
|
+
border-right: 1px solid var(--color-border-light);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
table thead td,
|
|
41
|
+
table thead th {
|
|
42
|
+
border-top: 1px solid var(--color-border-light);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* top-left border */
|
|
46
|
+
|
|
47
|
+
table thead tr:first-child th:first-child {
|
|
48
|
+
border-top-left-radius: var(--panel-border-radius);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* top-right border */
|
|
52
|
+
|
|
53
|
+
table thead tr:first-child th:last-child {
|
|
54
|
+
border-top-right-radius: var(--panel-border-radius);
|
|
55
|
+
border-top: 1px solid var(--color-border-light);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* bottom-left border */
|
|
59
|
+
|
|
60
|
+
table tbody tr:last-child td:first-child {
|
|
61
|
+
border-bottom-left-radius: var(--panel-border-radius);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* bottom-right border */
|
|
65
|
+
|
|
66
|
+
table tbody tr:last-child td:last-child {
|
|
67
|
+
border-bottom-right-radius: var(--panel-border-radius);
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export function margins(theme: ITypography): FlattenSimpleInterpolation | string {
|
|
72
|
+
if (!theme) return '';
|
|
73
|
+
|
|
74
|
+
return css`
|
|
75
|
+
${{
|
|
76
|
+
marginTop: theme.marginTop || theme.marginVertical || '',
|
|
77
|
+
marginBottom: theme.marginBottom || theme.marginVertical || '',
|
|
78
|
+
marginLeft: theme.marginLeft || theme.marginHorizontal || '',
|
|
79
|
+
marginRight: theme.marginRight || theme.marginHorizontal || '',
|
|
80
|
+
}}
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// TODO: Can users specify another className or we should hardcode it?
|
|
85
|
+
export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation {
|
|
86
|
+
return css`
|
|
87
|
+
.${className}.before {
|
|
88
|
+
position: absolute;
|
|
89
|
+
left: 0;
|
|
90
|
+
transform: translateX(-100%);
|
|
91
|
+
padding-right: 4px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.${className}.after {
|
|
95
|
+
display: inline-block;
|
|
96
|
+
padding-left: 4px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
svg,
|
|
100
|
+
.${className} svg {
|
|
101
|
+
visibility: hidden;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:hover .${className} svg,
|
|
105
|
+
.${className}:focus svg {
|
|
106
|
+
visibility: visible;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const StyledMarkdown = styled.main.attrs(() => ({
|
|
112
|
+
'data-component-name': 'Markdown/StyledMarkdown',
|
|
113
|
+
}))`
|
|
114
|
+
font-weight: var(--font-weight-regular);
|
|
115
|
+
padding: 0;
|
|
116
|
+
|
|
117
|
+
color: var(--color-text-main);
|
|
118
|
+
font-size: var(--font-size-base);
|
|
119
|
+
font-family: var(--font-family-primary);
|
|
120
|
+
line-height: var(--line-height-m);
|
|
121
|
+
|
|
122
|
+
a:not([role='button']) {
|
|
123
|
+
text-decoration: var(--links-text-decoration);
|
|
124
|
+
color: var(--links-color);
|
|
125
|
+
|
|
126
|
+
&:visited {
|
|
127
|
+
color: var(--links-color);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&:hover {
|
|
131
|
+
color: var(--links-color-hover);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
img {
|
|
136
|
+
max-width: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
h1,
|
|
140
|
+
h2,
|
|
141
|
+
h3,
|
|
142
|
+
h4,
|
|
143
|
+
h5,
|
|
144
|
+
h6 {
|
|
145
|
+
font-weight: var(--font-weight-h);
|
|
146
|
+
font-family: var(--font-family-h);
|
|
147
|
+
position: relative;
|
|
148
|
+
|
|
149
|
+
scroll-margin-top: 60px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
strong {
|
|
153
|
+
font-weight: var(--font-weight-bold);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
hr {
|
|
157
|
+
border-top: 1px solid var(--color-border-light);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
details {
|
|
161
|
+
margin: 1.125em 0;
|
|
162
|
+
|
|
163
|
+
summary {
|
|
164
|
+
color: var(--color-primary-main);
|
|
165
|
+
font-weight: var(--font-weight-regular);
|
|
166
|
+
outline: 0;
|
|
167
|
+
padding: 0;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
> :not(summary):first-of-type {
|
|
172
|
+
margin-top: 1.25em;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
> *:last-child {
|
|
176
|
+
margin-bottom: 1.25em;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
${baseTable};
|
|
181
|
+
|
|
182
|
+
.code-snippets-tabs {
|
|
183
|
+
.snippets-tabs-headers {
|
|
184
|
+
font-size: 0.9em;
|
|
185
|
+
|
|
186
|
+
font-family: var(--font-family-h);
|
|
187
|
+
|
|
188
|
+
.tab-header {
|
|
189
|
+
text-align: center;
|
|
190
|
+
padding: 0.2em 0.5em;
|
|
191
|
+
display: inline-block;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
color: var(--color-text-dimmed);
|
|
194
|
+
|
|
195
|
+
&.active {
|
|
196
|
+
color: var(--color-primary-main);
|
|
197
|
+
font-weight: var(--font-weight-bold);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.tab-content {
|
|
203
|
+
margin-top: 4px;
|
|
204
|
+
display: none;
|
|
205
|
+
|
|
206
|
+
pre {
|
|
207
|
+
margin-top: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&.active {
|
|
211
|
+
display: block;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
p {
|
|
217
|
+
&:last-child {
|
|
218
|
+
margin-bottom: 0;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
h1 {
|
|
223
|
+
${typography(typographyTokens.heading1)};
|
|
224
|
+
${margins(typographyTokens.heading1)};
|
|
225
|
+
${headingAnchor()};
|
|
226
|
+
|
|
227
|
+
&:first-child {
|
|
228
|
+
margin-top: 0;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
h2 {
|
|
233
|
+
${typography(typographyTokens.heading2)};
|
|
234
|
+
${margins(typographyTokens.heading2)};
|
|
235
|
+
${headingAnchor()};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
h3 {
|
|
239
|
+
${typography(typographyTokens.heading3)};
|
|
240
|
+
${margins(typographyTokens.heading3)};
|
|
241
|
+
${headingAnchor()};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
h4 {
|
|
245
|
+
${typography(typographyTokens.heading4)};
|
|
246
|
+
${margins(typographyTokens.heading4)};
|
|
247
|
+
${headingAnchor()};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
h5 {
|
|
251
|
+
${typography(typographyTokens.heading5)};
|
|
252
|
+
${margins(typographyTokens.heading5)};
|
|
253
|
+
${headingAnchor()};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
h6 {
|
|
257
|
+
${typography(typographyTokens.heading6)};
|
|
258
|
+
${margins(typographyTokens.heading6)};
|
|
259
|
+
${headingAnchor()};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
code {
|
|
263
|
+
color: var(--code-color);
|
|
264
|
+
background-color: var(--code-background-color);
|
|
265
|
+
|
|
266
|
+
border-radius: 2px;
|
|
267
|
+
border: 1px solid var(--color-border-light);
|
|
268
|
+
padding: 0.1em 0.25em 0.2em;
|
|
269
|
+
font-weight: var(--code-font-weight);
|
|
270
|
+
word-break: break-word;
|
|
271
|
+
font-size: var(--code-font-size);
|
|
272
|
+
font-family: var(--code-font-family);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
blockquote {
|
|
276
|
+
margin: var(--bloquote-margin-vertical) var(--bloquote-margin-horizontal);
|
|
277
|
+
padding: var(--bloquote-padding-vertical) var(--bloquote-padding-horizontal);
|
|
278
|
+
border-left: 4px solid var(--color-border-light);
|
|
279
|
+
background-color: var(--bloquote-background-color);
|
|
280
|
+
|
|
281
|
+
${typography(typographyTokens.blockquote)};
|
|
282
|
+
|
|
283
|
+
& > p:first-child {
|
|
284
|
+
margin-top: 0;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
img {
|
|
289
|
+
max-width: 100%;
|
|
290
|
+
box-sizing: content-box;
|
|
291
|
+
margin: 0 auto;
|
|
292
|
+
|
|
293
|
+
&:only-child {
|
|
294
|
+
display: block;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
> ul,
|
|
299
|
+
> p ul {
|
|
300
|
+
> ol,
|
|
301
|
+
> p ol {
|
|
302
|
+
padding-left: 2em;
|
|
303
|
+
margin: 0 0 1em;
|
|
304
|
+
|
|
305
|
+
ul,
|
|
306
|
+
ol {
|
|
307
|
+
margin-bottom: 0;
|
|
308
|
+
margin-top: 0;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
type TabProps = {
|
|
5
|
+
activeTab: string;
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: (e: string) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function Tab({ activeTab, label, onClick }: TabProps): JSX.Element {
|
|
11
|
+
const isActive = activeTab === label;
|
|
12
|
+
return (
|
|
13
|
+
<TabItem
|
|
14
|
+
active={isActive}
|
|
15
|
+
onClick={() => onClick(label)}
|
|
16
|
+
data-component-name="Markdown/Tabs/Tab"
|
|
17
|
+
>
|
|
18
|
+
{label}
|
|
19
|
+
</TabItem>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const TabItem = styled.li<{ active: boolean }>`
|
|
24
|
+
display: inline-block;
|
|
25
|
+
list-style: none;
|
|
26
|
+
margin-bottom: -1px;
|
|
27
|
+
padding: 0.75rem 1rem;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
|
|
30
|
+
${({ active }) =>
|
|
31
|
+
active &&
|
|
32
|
+
`
|
|
33
|
+
background-color: white;
|
|
34
|
+
border: solid #ccc;
|
|
35
|
+
border-width: 1px 1px 0 1px;
|
|
36
|
+
`}
|
|
37
|
+
`;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState, PropsWithChildren } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Tab } from '@theme/Markdown/Tabs/Tab';
|
|
5
|
+
|
|
6
|
+
type TabsProps = PropsWithChildren<{ children: { props: { label: string } & TabsProps }[] }>;
|
|
7
|
+
|
|
8
|
+
export function Tabs({ children }: TabsProps): JSX.Element {
|
|
9
|
+
const [activeTab, setActiveTab] = useState(children[0].props.label);
|
|
10
|
+
const onTabSelect = (label: string) => setActiveTab(label);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<TabsContainer data-component-name="Markdown/Tabs/Tabs">
|
|
14
|
+
<TabList>
|
|
15
|
+
{children.map((child) => {
|
|
16
|
+
const { label } = child.props;
|
|
17
|
+
return <Tab activeTab={activeTab} key={label} label={label} onClick={onTabSelect} />;
|
|
18
|
+
})}
|
|
19
|
+
</TabList>
|
|
20
|
+
<TabContent>
|
|
21
|
+
{children.map((child) => {
|
|
22
|
+
if (child.props.label !== activeTab) return undefined;
|
|
23
|
+
return child.props.children;
|
|
24
|
+
})}
|
|
25
|
+
</TabContent>
|
|
26
|
+
</TabsContainer>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const TabsContainer = styled.div`
|
|
31
|
+
margin: 10px 0;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const TabList = styled.ol`
|
|
35
|
+
border-bottom: 1px solid #ccc;
|
|
36
|
+
padding: 0;
|
|
37
|
+
margin-block-end: 0;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const TabContent = styled.div`
|
|
41
|
+
padding: 10px 5px;
|
|
42
|
+
border: 1px solid #ccc;
|
|
43
|
+
border-top: none;
|
|
44
|
+
padding: 1rem;
|
|
45
|
+
`;
|
|
@@ -9,23 +9,13 @@ import { Logo } from '@theme/Logo/Logo';
|
|
|
9
9
|
export default {
|
|
10
10
|
title: 'Navbar',
|
|
11
11
|
component: Navbar,
|
|
12
|
-
// argTypes: {
|
|
13
|
-
// size: {
|
|
14
|
-
// control: 'radio',
|
|
15
|
-
// options: ['small', 'medium', 'large', 'xlarge'],
|
|
16
|
-
// },
|
|
17
|
-
// color: {
|
|
18
|
-
// control: 'radio',
|
|
19
|
-
// options: ['primary', 'secondary', 'default'],
|
|
20
|
-
// },
|
|
21
|
-
// },
|
|
22
12
|
} as ComponentMeta<typeof Navbar>;
|
|
23
13
|
|
|
24
14
|
const Template: ComponentStory<typeof Navbar> = (args) => <Navbar {...args}>Click</Navbar>;
|
|
25
15
|
|
|
26
16
|
export const Main = Template.bind({});
|
|
27
17
|
Main.args = {
|
|
28
|
-
logo: <Logo logo={{ link: '/test/', image: 'https://picsum.photos/400/100' }} />,
|
|
18
|
+
logo: <Logo logo={{ link: '/test/', image: 'https://picsum.photos/id/2/400/100' }} />,
|
|
29
19
|
menu: (
|
|
30
20
|
<NavbarMenu
|
|
31
21
|
menuItems={[
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
// import { mediaQueries } from '@portal/media-css';
|
|
5
|
-
|
|
6
4
|
interface NavbarProps {
|
|
7
5
|
menu: React.ReactNode;
|
|
8
6
|
logo: React.ReactNode;
|
|
9
7
|
search: React.ReactNode;
|
|
8
|
+
theme: any;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export default function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
|
|
@@ -32,29 +31,24 @@ export const NavbarContainer = styled.nav`
|
|
|
32
31
|
position: sticky;
|
|
33
32
|
top: 0;
|
|
34
33
|
z-index: 200;
|
|
35
|
-
padding: 1.25rem;
|
|
36
34
|
padding: 10px var(--sidebar-margin-left);
|
|
37
35
|
background: var(--navbar-color-background);
|
|
38
|
-
font-family: var(--font-family
|
|
36
|
+
font-family: var(--h-font-family);
|
|
37
|
+
|
|
38
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
39
|
+
padding: 10px var(--sidebar-margin-left);
|
|
40
|
+
font-size: 1rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${({ theme }) => theme.mediaQueries.print} {
|
|
44
|
+
background: transparent;
|
|
45
|
+
display: none;
|
|
46
|
+
> :not(a, img) {
|
|
47
|
+
display: none !important;
|
|
48
|
+
}
|
|
49
|
+
img {
|
|
50
|
+
padding: 0;
|
|
51
|
+
margin: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
39
54
|
`;
|
|
40
|
-
|
|
41
|
-
// ${mediaQueries.medium} {
|
|
42
|
-
// padding: 10px var(--sidebar-margin-left);
|
|
43
|
-
// }
|
|
44
|
-
|
|
45
|
-
// ${mediaQueries.medium} {
|
|
46
|
-
// font-size: 1rem;
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
// ${mediaQueries.print} {
|
|
50
|
-
// background: transparent;
|
|
51
|
-
// display: none;
|
|
52
|
-
|
|
53
|
-
// > :not(a, img) {
|
|
54
|
-
// display: none !important;
|
|
55
|
-
// }
|
|
56
|
-
// img {
|
|
57
|
-
// padding: 0;
|
|
58
|
-
// margin: 0;
|
|
59
|
-
// }
|
|
60
|
-
// }
|
|
@@ -66,7 +66,7 @@ export default function NavbarItem({ navItem }: NavbarItemProps): JSX.Element {
|
|
|
66
66
|
|
|
67
67
|
const NavMenuItem = styled.li<{ active?: boolean }>`
|
|
68
68
|
display: inline-block;
|
|
69
|
-
padding: 20px calc(var(--sidebar-
|
|
69
|
+
padding: 20px calc(var(--sidebar-spacing-horizontal) * 2);
|
|
70
70
|
text-align: center;
|
|
71
71
|
line-height: 1;
|
|
72
72
|
font-size: var(--navbar-item-font-size);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { OperationBadge } from '@theme/OperationBadge';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'OperationBadge',
|
|
8
|
+
component: OperationBadge,
|
|
9
|
+
argTypes: {},
|
|
10
|
+
} as ComponentMeta<typeof OperationBadge>;
|
|
11
|
+
|
|
12
|
+
const Template: ComponentStory<typeof OperationBadge> = (args) => (
|
|
13
|
+
<OperationBadge {...args}>Default</OperationBadge>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {};
|
|
18
|
+
|
|
19
|
+
const TemplateAll: ComponentStory<typeof OperationBadge> = () => (
|
|
20
|
+
<>
|
|
21
|
+
<OperationBadge type="get">get</OperationBadge>
|
|
22
|
+
<OperationBadge type="post">post</OperationBadge>
|
|
23
|
+
<OperationBadge type="put">put</OperationBadge>
|
|
24
|
+
<OperationBadge type="delete">delete</OperationBadge>
|
|
25
|
+
<OperationBadge type="options">options</OperationBadge>
|
|
26
|
+
<OperationBadge type="patch">patch</OperationBadge>
|
|
27
|
+
<OperationBadge type="basic">basic</OperationBadge>
|
|
28
|
+
<OperationBadge type="link">link</OperationBadge>
|
|
29
|
+
<OperationBadge type="head">head</OperationBadge>
|
|
30
|
+
<OperationBadge type="hook">hook</OperationBadge>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const All = TemplateAll.bind({});
|
|
35
|
+
All.args = {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
|
|
4
|
+
className: `operation-type ${props.type}`,
|
|
5
|
+
}))<{ type: string }>`
|
|
6
|
+
display: inline-block;
|
|
7
|
+
font-size: var(--http-badge-menu-font-size);
|
|
8
|
+
font-family: var(--http-badge-font-family);
|
|
9
|
+
font-weight: var(--http-badge-font-weight);
|
|
10
|
+
line-height: var(--http-badge-menu-line-height);
|
|
11
|
+
color: var(--http-badge-color);
|
|
12
|
+
background-color: #333;
|
|
13
|
+
border-radius: var(--http-badge-border-radius);
|
|
14
|
+
width: 36px;
|
|
15
|
+
height: 14px;
|
|
16
|
+
text-transform: uppercase;
|
|
17
|
+
text-align: center;
|
|
18
|
+
margin-right: 6px;
|
|
19
|
+
|
|
20
|
+
&.get {
|
|
21
|
+
background-color: var(--color-http-get);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.post {
|
|
25
|
+
background-color: var(--color-http-post);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.put {
|
|
29
|
+
background-color: var(--color-http-put);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.options {
|
|
33
|
+
background-color: var(--color-http-options);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.patch {
|
|
37
|
+
background-color: var(--color-http-patch);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.delete {
|
|
41
|
+
background-color: var(--color-http-delete);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.basic {
|
|
45
|
+
background-color: var(--color-http-basic);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.link {
|
|
49
|
+
background-color: var(--color-http-link);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.head {
|
|
53
|
+
background-color: var(--color-http-head);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.hook {
|
|
57
|
+
background-color: var(--color-http-hook);
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import { OperationBadge } from '@theme/OperationBadge';
|
|
5
|
+
|
|
6
|
+
describe('OperationBadge', () => {
|
|
7
|
+
it('renders basic', () => {
|
|
8
|
+
const { container } = render(<OperationBadge type={'basic'}>basic</OperationBadge>);
|
|
9
|
+
|
|
10
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('renders get', () => {
|
|
14
|
+
const { container } = render(<OperationBadge type={'get'}>get</OperationBadge>);
|
|
15
|
+
|
|
16
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('renders post', () => {
|
|
20
|
+
const { container } = render(<OperationBadge type={'post'}>post</OperationBadge>);
|
|
21
|
+
|
|
22
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
it('renders put', () => {
|
|
25
|
+
const { container } = render(<OperationBadge type={'put'}>put</OperationBadge>);
|
|
26
|
+
|
|
27
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
it('renders delete', () => {
|
|
30
|
+
const { container } = render(<OperationBadge type={'delete'}>delete</OperationBadge>);
|
|
31
|
+
|
|
32
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
it('renders options', () => {
|
|
35
|
+
const { container } = render(<OperationBadge type={'options'}>options</OperationBadge>);
|
|
36
|
+
|
|
37
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
it('renders patch', () => {
|
|
40
|
+
const { container } = render(<OperationBadge type={'patch'}>patch</OperationBadge>);
|
|
41
|
+
|
|
42
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
it('renders link', () => {
|
|
45
|
+
const { container } = render(<OperationBadge type={'link'}>link</OperationBadge>);
|
|
46
|
+
|
|
47
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
it('renders head', () => {
|
|
50
|
+
const { container } = render(<OperationBadge type={'head'}>head</OperationBadge>);
|
|
51
|
+
|
|
52
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
it('renders hook', () => {
|
|
55
|
+
const { container } = render(<OperationBadge type={'hook'}>hook</OperationBadge>);
|
|
56
|
+
|
|
57
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
});
|