@redocly/theme 0.1.7 → 0.1.10
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/Button/index.d.ts +1 -1
- package/Button/index.js +1 -1
- package/CodeBlock/index.d.ts +1 -1
- package/CodeBlock/index.js +1 -1
- package/CopyButton/index.d.ts +2 -2
- package/CopyButton/index.js +2 -2
- 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/Headings/index.d.ts +1 -1
- package/Headings/index.js +1 -1
- package/JsonViewer/JsonViewer.js +1 -1
- package/JsonViewer/index.d.ts +2 -1
- package/JsonViewer/index.js +2 -1
- 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/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 +1 -1
- package/Navbar/Navbar.js +9 -3
- package/Navbar/NavbarItem.d.ts +1 -1
- package/Navbar/NavbarItem.js +4 -4
- package/Navbar/NavbarMenu.d.ts +1 -1
- package/Navbar/NavbarMenu.js +8 -4
- package/Navbar/index.d.ts +3 -0
- package/Navbar/index.js +19 -0
- package/NavbarLogo/NavbarLogo.d.ts +6 -0
- package/{Logo/Logo.js → NavbarLogo/NavbarLogo.js} +8 -5
- package/NavbarLogo/index.d.ts +1 -0
- package/NavbarLogo/index.js +17 -0
- 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/PageNavigation/index.d.ts +3 -0
- package/PageNavigation/index.js +19 -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 +8 -7
- package/Panel/index.js +8 -7
- package/REAMDE.md +1 -0
- package/SamplesPanelControls/index.d.ts +1 -1
- package/SamplesPanelControls/index.js +1 -1
- 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/SidebarLogo/index.d.ts +1 -1
- package/SidebarLogo/index.js +1 -1
- package/SourceCode/SourceCode.js +2 -2
- package/SourceCode/index.d.ts +1 -1
- package/SourceCode/index.js +1 -1
- 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/Tooltip/index.d.ts +1 -1
- package/Tooltip/index.js +1 -1
- package/globalStyle.js +1 -1
- package/hooks/index.d.ts +7 -3
- package/hooks/index.js +7 -3
- package/hooks/useActiveHeading.d.ts +2 -0
- package/hooks/useActiveHeading.js +34 -0
- package/hooks/useActiveSectionId.d.ts +3 -0
- package/hooks/useActiveSectionId.js +49 -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/icons/ShelfIcon/index.d.ts +2 -2
- package/icons/ShelfIcon/index.js +1 -1
- package/icons/index.d.ts +1 -1
- package/icons/index.js +1 -1
- 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 +2 -2
- package/src/Button/__tests__/Button.test.tsx +1 -1
- package/src/Button/index.ts +1 -1
- package/src/CodeBlock/__tests__/CodeBlock.test.tsx +1 -1
- package/src/CodeBlock/index.ts +1 -1
- package/src/CopyButton/CopyButton.stories.tsx +2 -2
- 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/CopyButton/index.ts +2 -2
- package/src/Footer/Footer.stories.tsx +57 -0
- package/src/Footer/Footer.tsx +31 -0
- package/src/Footer/FooterColumn.tsx +62 -0
- package/src/Footer/FooterColumns.tsx +53 -0
- package/src/Footer/FooterCopyright.tsx +28 -0
- package/src/Footer/__tests__/Footer.test.tsx +55 -0
- package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +253 -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/Headings/index.ts +1 -1
- package/src/JsonViewer/JsonViewer.stories.tsx +2 -2
- package/src/JsonViewer/JsonViewer.tsx +6 -7
- package/src/JsonViewer/__tests__/JsonViewer.test.tsx +2 -1
- package/src/JsonViewer/index.ts +2 -1
- package/src/Layout/PageLayout.tsx +34 -0
- package/src/Layout/RootLayout.tsx +24 -0
- package/src/Layout/__tests__/PageLayout.test.tsx +17 -0
- package/src/Layout/__tests__/RootLayout.test.tsx +17 -0
- package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +38 -0
- package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +18 -0
- package/src/Layout/index.ts +2 -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 +38 -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 +9 -15
- package/src/Navbar/Navbar.tsx +21 -28
- package/src/Navbar/NavbarItem.tsx +3 -3
- package/src/Navbar/NavbarMenu.tsx +6 -6
- package/src/Navbar/index.ts +3 -0
- package/src/NavbarLogo/NavbarLogo.stories.tsx +20 -0
- package/src/NavbarLogo/NavbarLogo.tsx +24 -0
- package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +47 -0
- package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +38 -0
- package/src/NavbarLogo/index.ts +1 -0
- 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/PageNavigation/index.ts +3 -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 +8 -7
- package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +2 -2
- package/src/SamplesPanelControls/SamplesPanelControls.ts +1 -1
- package/src/SamplesPanelControls/index.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 +2 -2
- package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +1 -1
- package/src/SidebarLogo/index.ts +1 -1
- package/src/SourceCode/SourceCode.stories.tsx +2 -2
- package/src/SourceCode/SourceCode.tsx +7 -3
- package/src/SourceCode/__tests__/SourceCode.test.tsx +2 -1
- package/src/SourceCode/index.ts +1 -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 +2 -2
- package/src/Tooltip/Tooltip.tsx +1 -1
- package/src/Tooltip/__tests__/Tooltip.test.tsx +1 -1
- package/src/Tooltip/index.ts +1 -1
- package/src/Welcome.stories.mdx +7 -0
- package/src/globalStyle.ts +99 -28
- package/src/hooks/index.ts +7 -3
- 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/icons/ShelfIcon/index.ts +2 -2
- package/src/icons/index.ts +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 +5 -0
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +41 -0
- package/src/types/portal/src/client/app/media-css.d.ts +7 -0
- package/src/types/portal/src/client/styling/default.d.ts +601 -0
- package/src/types/portal/src/client/styling/index.d.ts +10 -0
- package/src/types/portal/src/client/styling/resolve.d.ts +1 -0
- package/src/types/portal/src/server/constants.d.ts +7 -0
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +23 -0
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +23 -0
- package/src/types/portal/src/server/plugins/types.d.ts +55 -0
- package/src/types/portal/src/server/store.d.ts +53 -0
- package/src/types/portal/src/server/utils/async.d.ts +1 -0
- package/src/types/portal/src/server/utils/content-provider.d.ts +51 -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 +13 -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/yaml.d.ts +1 -0
- package/src/types/portal/src/server/version-store.d.ts +35 -0
- package/src/types/portal/src/shared/constants.d.ts +8 -0
- package/src/types/portal/src/shared/types.d.ts +116 -0
- package/src/types/portal/src/shared/urls.d.ts +8 -0
- package/src/types/portal/src/shared/utils.d.ts +10 -0
- package/src/ui/AlertIcon.tsx +111 -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 +10 -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
- package/Logo/Logo.d.ts +0 -10
- package/src/Introduction.stories.mdx +0 -7
- package/src/Logo/Logo.tsx +0 -23
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Footer renders columns with copyright and columns 1`] = `
|
|
4
|
+
.c4 {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
font-weight: var(--font-weight-regular);
|
|
7
|
+
font-size: 24px;
|
|
8
|
+
margin-bottom: 1.5em;
|
|
9
|
+
font-family: var(--h-font-family);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.c6 {
|
|
13
|
+
opacity: 0.75;
|
|
14
|
+
margin: 10px 0 5px 0;
|
|
15
|
+
font-size: 0.75em;
|
|
16
|
+
text-transform: uppercase;
|
|
17
|
+
font-family: var(--h-font-family);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.c3 {
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
display: -webkit-flex;
|
|
23
|
+
display: -ms-flexbox;
|
|
24
|
+
display: flex;
|
|
25
|
+
-webkit-flex-direction: column;
|
|
26
|
+
-ms-flex-direction: column;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
text-align: left;
|
|
29
|
+
margin: 0 30px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.c5 {
|
|
33
|
+
font-weight: var(--font-weight-bold);
|
|
34
|
+
padding-bottom: 0.75em;
|
|
35
|
+
color: var(--footer-text-color);
|
|
36
|
+
-webkit-text-decoration: none;
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.c1 {
|
|
41
|
+
padding: 3em 20px 1em 20px;
|
|
42
|
+
display: -webkit-box;
|
|
43
|
+
display: -webkit-flex;
|
|
44
|
+
display: -ms-flexbox;
|
|
45
|
+
display: flex;
|
|
46
|
+
-webkit-flex-direction: column;
|
|
47
|
+
-ms-flex-direction: column;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
-webkit-box-pack: center;
|
|
50
|
+
-webkit-justify-content: center;
|
|
51
|
+
-ms-flex-pack: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
max-width: 1200px;
|
|
54
|
+
margin: 0 auto;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.c2 {
|
|
58
|
+
display: -webkit-box;
|
|
59
|
+
display: -webkit-flex;
|
|
60
|
+
display: -ms-flexbox;
|
|
61
|
+
display: flex;
|
|
62
|
+
-webkit-flex-wrap: wrap;
|
|
63
|
+
-ms-flex-wrap: wrap;
|
|
64
|
+
flex-wrap: wrap;
|
|
65
|
+
-webkit-box-pack: start;
|
|
66
|
+
-webkit-justify-content: flex-start;
|
|
67
|
+
-ms-flex-pack: start;
|
|
68
|
+
justify-content: flex-start;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.c7 {
|
|
72
|
+
display: -webkit-box;
|
|
73
|
+
display: -webkit-flex;
|
|
74
|
+
display: -ms-flexbox;
|
|
75
|
+
display: flex;
|
|
76
|
+
-webkit-box-pack: center;
|
|
77
|
+
-webkit-justify-content: center;
|
|
78
|
+
-ms-flex-pack: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
font-size: 0.875em;
|
|
81
|
+
padding: 1.5em 3em;
|
|
82
|
+
font-weight: var(--font-weight-bold);
|
|
83
|
+
background-color: var(--footer-background-color);
|
|
84
|
+
color: var(--footer-text-color);
|
|
85
|
+
text-align: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.c7 span {
|
|
89
|
+
max-width: 1200px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.c0 {
|
|
93
|
+
font-size: 1rem;
|
|
94
|
+
-webkit-flex-shrink: 0;
|
|
95
|
+
-ms-flex-negative: 0;
|
|
96
|
+
flex-shrink: 0;
|
|
97
|
+
background-color: var(--footer-background-color);
|
|
98
|
+
color: var(--footer-text-color);
|
|
99
|
+
font-family: var(--font-family-base);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.c0 a,
|
|
103
|
+
.c0 a:hover {
|
|
104
|
+
color: var(--footer-text-color);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media screen and (min-width:50rem) {
|
|
108
|
+
.c1 {
|
|
109
|
+
padding: 5.625em 20px 3.9375em 20px;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media print {
|
|
114
|
+
.c1 {
|
|
115
|
+
color: black;
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media screen and (min-width:50rem) {
|
|
121
|
+
.c2 {
|
|
122
|
+
-webkit-box-pack: space-evenly;
|
|
123
|
+
-webkit-justify-content: space-evenly;
|
|
124
|
+
-ms-flex-pack: space-evenly;
|
|
125
|
+
justify-content: space-evenly;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
<footer
|
|
130
|
+
class="c0"
|
|
131
|
+
data-component-name="Footer/Footer"
|
|
132
|
+
>
|
|
133
|
+
<div
|
|
134
|
+
class="c1"
|
|
135
|
+
data-component-name="Footer/FooterColumns"
|
|
136
|
+
>
|
|
137
|
+
<div
|
|
138
|
+
class="c2"
|
|
139
|
+
>
|
|
140
|
+
<div
|
|
141
|
+
class="c3"
|
|
142
|
+
data-component-name="Footer/FooterColumn"
|
|
143
|
+
>
|
|
144
|
+
<p
|
|
145
|
+
class="c4"
|
|
146
|
+
>
|
|
147
|
+
Other
|
|
148
|
+
</p>
|
|
149
|
+
<a
|
|
150
|
+
class="c5"
|
|
151
|
+
data-cy="External"
|
|
152
|
+
href="https://google.com/"
|
|
153
|
+
to="https://google.com/"
|
|
154
|
+
>
|
|
155
|
+
External
|
|
156
|
+
</a>
|
|
157
|
+
<div
|
|
158
|
+
class="c6"
|
|
159
|
+
/>
|
|
160
|
+
<a
|
|
161
|
+
class="c5"
|
|
162
|
+
data-cy="Twitter"
|
|
163
|
+
href="https://twitter.com/"
|
|
164
|
+
to="https://twitter.com/"
|
|
165
|
+
>
|
|
166
|
+
Twitter
|
|
167
|
+
</a>
|
|
168
|
+
</div>
|
|
169
|
+
<div
|
|
170
|
+
class="c3"
|
|
171
|
+
data-component-name="Footer/FooterColumn"
|
|
172
|
+
>
|
|
173
|
+
<p
|
|
174
|
+
class="c4"
|
|
175
|
+
>
|
|
176
|
+
Another
|
|
177
|
+
</p>
|
|
178
|
+
<div
|
|
179
|
+
class="c6"
|
|
180
|
+
/>
|
|
181
|
+
<a
|
|
182
|
+
class="c5"
|
|
183
|
+
data-cy="Twitter"
|
|
184
|
+
href="https://twitter.com/"
|
|
185
|
+
to="https://twitter.com/"
|
|
186
|
+
>
|
|
187
|
+
Twitter
|
|
188
|
+
</a>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
<section
|
|
193
|
+
class="c7"
|
|
194
|
+
data-component-name="Footer/FooterCopyright"
|
|
195
|
+
>
|
|
196
|
+
Copyright®
|
|
197
|
+
</section>
|
|
198
|
+
</footer>
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
exports[`Footer renders columns with copyright only 1`] = `
|
|
202
|
+
.c1 {
|
|
203
|
+
display: -webkit-box;
|
|
204
|
+
display: -webkit-flex;
|
|
205
|
+
display: -ms-flexbox;
|
|
206
|
+
display: flex;
|
|
207
|
+
-webkit-box-pack: center;
|
|
208
|
+
-webkit-justify-content: center;
|
|
209
|
+
-ms-flex-pack: center;
|
|
210
|
+
justify-content: center;
|
|
211
|
+
font-size: 0.875em;
|
|
212
|
+
padding: 1.5em 3em;
|
|
213
|
+
font-weight: var(--font-weight-bold);
|
|
214
|
+
background-color: var(--footer-background-color);
|
|
215
|
+
color: var(--footer-text-color);
|
|
216
|
+
text-align: center;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.c1 span {
|
|
220
|
+
max-width: 1200px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.c0 {
|
|
224
|
+
font-size: 1rem;
|
|
225
|
+
-webkit-flex-shrink: 0;
|
|
226
|
+
-ms-flex-negative: 0;
|
|
227
|
+
flex-shrink: 0;
|
|
228
|
+
background-color: var(--footer-background-color);
|
|
229
|
+
color: var(--footer-text-color);
|
|
230
|
+
font-family: var(--font-family-base);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.c0 a,
|
|
234
|
+
.c0 a:hover {
|
|
235
|
+
color: var(--footer-text-color);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
<footer
|
|
239
|
+
class="c0"
|
|
240
|
+
data-component-name="Footer/Footer"
|
|
241
|
+
>
|
|
242
|
+
<section
|
|
243
|
+
class="c1"
|
|
244
|
+
data-component-name="Footer/FooterCopyright"
|
|
245
|
+
>
|
|
246
|
+
Copyright®
|
|
247
|
+
</section>
|
|
248
|
+
</footer>
|
|
249
|
+
`;
|
|
250
|
+
|
|
251
|
+
exports[`Footer renders nothing, if empty columns and copyright provided 1`] = `null`;
|
|
252
|
+
|
|
253
|
+
exports[`Footer renders nothing, if no columns and copyright provided 1`] = `null`;
|
package/src/Headings/Headings.ts
CHANGED
package/src/Headings/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@theme/Headings/Headings';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
3
|
|
|
4
|
-
import { JsonViewer } from '
|
|
4
|
+
import { JsonViewer } from '@theme/JsonViewer';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
title: 'JsonViewer',
|
|
7
|
+
title: 'Components/JsonViewer',
|
|
8
8
|
component: JsonViewer,
|
|
9
9
|
} as ComponentMeta<typeof JsonViewer>;
|
|
10
10
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { memo, useRef, ReactElement } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { CopyButtonWrapper } from '
|
|
5
|
-
import { SampleControls, SamplesControlButton } from '
|
|
6
|
-
import { jsonToHTML } from '
|
|
7
|
-
import { useMount, useUnmount } from '
|
|
8
|
-
import { CodeBlock } from '
|
|
9
|
-
|
|
10
|
-
import { jsonStyles } from './styled';
|
|
4
|
+
import { CopyButtonWrapper } from '@theme/CopyButton';
|
|
5
|
+
import { SampleControls, SamplesControlButton } from '@theme/SamplesPanelControls';
|
|
6
|
+
import { jsonToHTML } from '@theme/utils';
|
|
7
|
+
import { useMount, useUnmount } from '@theme/hooks';
|
|
8
|
+
import { CodeBlock } from '@theme/CodeBlock';
|
|
9
|
+
import { jsonStyles } from '@theme/JsonViewer/styled';
|
|
11
10
|
|
|
12
11
|
export interface JsonProps {
|
|
13
12
|
data: any;
|
|
@@ -2,7 +2,8 @@ import { fireEvent, screen } from '@testing-library/react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { renderWithTheme } from '../../../tests/utils';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import { JsonViewer } from '@theme/JsonViewer';
|
|
6
7
|
|
|
7
8
|
const data = {
|
|
8
9
|
id: '600dc3b5d617e547a0e74cb9',
|
package/src/JsonViewer/index.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@theme/JsonViewer/JsonViewer';
|
|
2
|
+
export * from '@theme/JsonViewer/styled';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
interface PageLayoutProps {
|
|
5
|
+
sidebar?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function PageLayout({
|
|
9
|
+
sidebar,
|
|
10
|
+
children,
|
|
11
|
+
}: React.PropsWithChildren<PageLayoutProps>): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<Container data-component-name="Layout/PageLayout">
|
|
14
|
+
{sidebar}
|
|
15
|
+
<ContentContainer>{children}</ContentContainer>
|
|
16
|
+
</Container>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Container = styled.div`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
min-height: calc(100vh - var(--navbar-height));
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const ContentContainer = styled.div`
|
|
27
|
+
flex: 1 0 0;
|
|
28
|
+
/*
|
|
29
|
+
flex-basis is ignored for nested flex in Chrome, need to set width
|
|
30
|
+
See more here: https://stackoverflow.com/a/34355447
|
|
31
|
+
*/
|
|
32
|
+
width: 0;
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
interface LayoutConfig {
|
|
5
|
+
navbar: React.ReactNode;
|
|
6
|
+
footer: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Wrapper = styled.div``;
|
|
10
|
+
|
|
11
|
+
export function RootLayout({
|
|
12
|
+
navbar,
|
|
13
|
+
footer,
|
|
14
|
+
children,
|
|
15
|
+
}: React.PropsWithChildren<LayoutConfig>): JSX.Element {
|
|
16
|
+
return (
|
|
17
|
+
// TODO: rewrite it to avoid passing components as props
|
|
18
|
+
<Wrapper data-component-name="Layout/RootLayout">
|
|
19
|
+
{navbar}
|
|
20
|
+
{children}
|
|
21
|
+
{footer}
|
|
22
|
+
</Wrapper>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
+
|
|
5
|
+
import { PageLayout } from '@theme/Layout/PageLayout';
|
|
6
|
+
|
|
7
|
+
describe('PageLayout', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const { container } = renderWithTheme(
|
|
10
|
+
<PageLayout sidebar={<div>sidebar</div>}>
|
|
11
|
+
<div>test content</div>
|
|
12
|
+
</PageLayout>,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
+
|
|
5
|
+
import { RootLayout } from '@theme/Layout/RootLayout';
|
|
6
|
+
|
|
7
|
+
describe('RootLayout', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const { container } = renderWithTheme(
|
|
10
|
+
<RootLayout footer={<div>footer</div>} navbar={<div>navbar</div>}>
|
|
11
|
+
<div>content</div>
|
|
12
|
+
</RootLayout>,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`PageLayout renders 1`] = `
|
|
4
|
+
.c0 {
|
|
5
|
+
display: -webkit-box;
|
|
6
|
+
display: -webkit-flex;
|
|
7
|
+
display: -ms-flexbox;
|
|
8
|
+
display: flex;
|
|
9
|
+
-webkit-flex-direction: row;
|
|
10
|
+
-ms-flex-direction: row;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
min-height: calc(100vh - var(--navbar-height));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.c1 {
|
|
16
|
+
-webkit-flex: 1 0 0;
|
|
17
|
+
-ms-flex: 1 0 0;
|
|
18
|
+
flex: 1 0 0;
|
|
19
|
+
width: 0;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class="c0"
|
|
25
|
+
data-component-name="Layout/PageLayout"
|
|
26
|
+
>
|
|
27
|
+
<div>
|
|
28
|
+
sidebar
|
|
29
|
+
</div>
|
|
30
|
+
<div
|
|
31
|
+
class="c1"
|
|
32
|
+
>
|
|
33
|
+
<div>
|
|
34
|
+
test content
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`RootLayout renders 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
class=""
|
|
6
|
+
data-component-name="Layout/RootLayout"
|
|
7
|
+
>
|
|
8
|
+
<div>
|
|
9
|
+
navbar
|
|
10
|
+
</div>
|
|
11
|
+
<div>
|
|
12
|
+
content
|
|
13
|
+
</div>
|
|
14
|
+
<div>
|
|
15
|
+
footer
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
`;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { AlertIcon } from '@theme/ui/AlertIcon';
|
|
5
|
+
|
|
6
|
+
interface AdmonitionTypeProps {
|
|
7
|
+
type: 'warning' | 'success' | 'danger' | 'attention' | 'info';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface AdmonitionProps extends Partial<AdmonitionTypeProps> {
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Admonition({
|
|
15
|
+
type = 'info',
|
|
16
|
+
name,
|
|
17
|
+
children,
|
|
18
|
+
}: React.PropsWithChildren<AdmonitionProps>): JSX.Element {
|
|
19
|
+
return (
|
|
20
|
+
<Wrapper type={type} data-component-name="Markdown/Admonition/Admonition">
|
|
21
|
+
<AlertIcon type={type} />
|
|
22
|
+
{name ? <Heading type={type}>{name}</Heading> : null}
|
|
23
|
+
<Content>{children}</Content>
|
|
24
|
+
</Wrapper>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Wrapper = styled.div<AdmonitionTypeProps>`
|
|
29
|
+
position: relative;
|
|
30
|
+
align-items: center;
|
|
31
|
+
margin: var(--admonition-margin-vertical) var(--admonition-margin-horizontal);
|
|
32
|
+
padding: var(--admonition-padding-vertical) var(--admonition-padding-horizontal);
|
|
33
|
+
padding-left: calc(var(--admonition-padding-horizontal) * 2 + var(--admonition-icon-size));
|
|
34
|
+
border-radius: var(--admonition-border-radius);
|
|
35
|
+
font-size: var(--admonition-font-size);
|
|
36
|
+
font-weight: var(--admonition-font-weight);
|
|
37
|
+
line-height: var(--admonition-line-height);
|
|
38
|
+
|
|
39
|
+
${({ type }) => `
|
|
40
|
+
background-color: var(--admonition-${type}-background-color);
|
|
41
|
+
color: var(--admonition-${type}-text-color);
|
|
42
|
+
`}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
const Heading = styled.h5<AdmonitionTypeProps>`
|
|
46
|
+
display: block;
|
|
47
|
+
margin: 0 0 10px;
|
|
48
|
+
|
|
49
|
+
letter-spacing: var(--admonition-heading-letter-spacing);
|
|
50
|
+
color: ${({ type }) => `var(--admonition-${type}-text-color)`};
|
|
51
|
+
|
|
52
|
+
&& {
|
|
53
|
+
font-size: var(--admonition-heading-font-size);
|
|
54
|
+
font-weight: var(--admonition-heading-font-weight);
|
|
55
|
+
line-height: var(--admonition-line-height);
|
|
56
|
+
transform: var(--admonition-heading-transform);
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const Content = styled.div`
|
|
61
|
+
& > p:first-child {
|
|
62
|
+
margin-top: 0;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ClipboardService } from '@theme/utils/ClipboardService';
|
|
4
|
+
import {
|
|
5
|
+
Wrapper,
|
|
6
|
+
DoneIndicator,
|
|
7
|
+
CopyCodeButton,
|
|
8
|
+
CodeSampleButtonContainer,
|
|
9
|
+
} from '@theme/Markdown/CodeSample/styled';
|
|
10
|
+
|
|
11
|
+
type CodeSampleProps = {
|
|
12
|
+
language: string;
|
|
13
|
+
highlighted: string;
|
|
14
|
+
rawContent: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element {
|
|
18
|
+
const langClassName = language ? `language-${language}` : '';
|
|
19
|
+
|
|
20
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
21
|
+
|
|
22
|
+
const copyCode = (code: string) => {
|
|
23
|
+
ClipboardService.copyCustom(code);
|
|
24
|
+
setIsCopied(true);
|
|
25
|
+
setTimeout(() => setIsCopied(false), 1500);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Wrapper className="code-sample" data-component-name="Markdown/CodeSample/CodeSample">
|
|
30
|
+
<CodeSampleButtonContainer onClick={() => copyCode(rawContent)}>
|
|
31
|
+
{!isCopied && <CopyCodeButton title="Copy the code snippet">Copy</CopyCodeButton>}
|
|
32
|
+
{isCopied && <DoneIndicator>Copied</DoneIndicator>}
|
|
33
|
+
</CodeSampleButtonContainer>
|
|
34
|
+
<pre className={langClassName}>
|
|
35
|
+
<code className={langClassName} dangerouslySetInnerHTML={{ __html: highlighted }} />
|
|
36
|
+
</pre>
|
|
37
|
+
</Wrapper>
|
|
38
|
+
);
|
|
39
|
+
}
|