@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,132 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Link } from '@portal/Link';
|
|
5
|
+
import { Version } from '@theme/types/portal';
|
|
6
|
+
|
|
7
|
+
type DropdownProps = {
|
|
8
|
+
items: Version[];
|
|
9
|
+
activeItem: Version;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Icon = () => (
|
|
13
|
+
<svg
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
width="16"
|
|
16
|
+
height="16"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
fill="none"
|
|
19
|
+
stroke="currentColor"
|
|
20
|
+
strokeWidth="2"
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
strokeLinejoin="round"
|
|
23
|
+
>
|
|
24
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const DropDownContainer = styled.div`
|
|
29
|
+
position: relative;
|
|
30
|
+
padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 4);
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const DropDownHeader = styled.div`
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
align-items: center;
|
|
37
|
+
background: #fff;
|
|
38
|
+
padding: 8px 10px;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
border: 1px solid #e4e7eb;
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
color: var(--color-text-main);
|
|
43
|
+
background: var(--color-secondary-300);
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const DropDownList = styled.div`
|
|
47
|
+
position: absolute;
|
|
48
|
+
background: var(--color-secondary-300);
|
|
49
|
+
margin: 2px 20px 0 20px;
|
|
50
|
+
padding: 0;
|
|
51
|
+
border-radius: 4px;
|
|
52
|
+
border: 1px solid rgba(38, 50, 56, 0.2);
|
|
53
|
+
z-index: 9999;
|
|
54
|
+
left: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const IconWrapper = styled.span`
|
|
59
|
+
transition: transform 0.2s;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
font-size: 0;
|
|
62
|
+
&.active {
|
|
63
|
+
transform: rotate(-180deg);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const ListItem = styled.div`
|
|
68
|
+
background-color: var(--background-color);
|
|
69
|
+
padding: 0.4em 10px;
|
|
70
|
+
font-size: 1em;
|
|
71
|
+
color: var(--color-text-main);
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
&:hover {
|
|
74
|
+
background-color: rgba(38, 50, 56, 0.12);
|
|
75
|
+
}
|
|
76
|
+
&.active {
|
|
77
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
const DropDownLink = styled(Link)`
|
|
82
|
+
display: block;
|
|
83
|
+
text-decoration: none;
|
|
84
|
+
color: var(--color-text-main);
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
export default function Dropdown({ items, activeItem }: DropdownProps): JSX.Element {
|
|
88
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
89
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
90
|
+
const toggling = () => setIsOpen(!isOpen);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const checkIfClickedOutside = (e: MouseEvent) => {
|
|
93
|
+
if (!(e.target instanceof HTMLElement)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (isOpen && ref.current && !ref.current.contains(e.target)) {
|
|
98
|
+
setIsOpen(false);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
document.addEventListener('mousedown', checkIfClickedOutside);
|
|
103
|
+
|
|
104
|
+
return () => {
|
|
105
|
+
document.removeEventListener('mousedown', checkIfClickedOutside);
|
|
106
|
+
};
|
|
107
|
+
}, [isOpen]);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<DropDownContainer ref={ref} data-component-name="ui/Dropdown">
|
|
111
|
+
<DropDownHeader onClick={toggling}>
|
|
112
|
+
{activeItem?.label || activeItem.version}
|
|
113
|
+
<IconWrapper className={isOpen ? 'active' : ''}>
|
|
114
|
+
<Icon />
|
|
115
|
+
</IconWrapper>
|
|
116
|
+
</DropDownHeader>
|
|
117
|
+
{isOpen && (
|
|
118
|
+
<DropDownList>
|
|
119
|
+
{items.map((item) => (
|
|
120
|
+
<ListItem
|
|
121
|
+
className={activeItem.version === item.version ? 'active' : ''}
|
|
122
|
+
onClick={toggling}
|
|
123
|
+
key={item?.link + item?.version}
|
|
124
|
+
>
|
|
125
|
+
<DropDownLink to={item?.link || '#'}>{item?.label || item.version}</DropDownLink>
|
|
126
|
+
</ListItem>
|
|
127
|
+
))}
|
|
128
|
+
</DropDownList>
|
|
129
|
+
)}
|
|
130
|
+
</DropDownContainer>
|
|
131
|
+
);
|
|
132
|
+
}
|
package/src/ui/Flex.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { flexbox, FlexboxProps, width, WidthProps } from 'styled-system';
|
|
4
|
+
|
|
5
|
+
import { Box } from '@theme/ui/Box';
|
|
6
|
+
|
|
7
|
+
export interface FlexProps extends FlexboxProps, WidthProps {}
|
|
8
|
+
|
|
9
|
+
export const Flex = styled(Box).attrs({ 'data-component-name': 'ui/Flex' })<FlexProps>`
|
|
10
|
+
display: flex;
|
|
11
|
+
${flexbox}
|
|
12
|
+
${width}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export function FlexSection(props: React.PropsWithChildren<FlexProps>): JSX.Element {
|
|
16
|
+
return (
|
|
17
|
+
<Flex {...props} width={props.width || { xs: '90%', large: 910 }}>
|
|
18
|
+
{props.children}
|
|
19
|
+
</Flex>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { space } from 'styled-system';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { H1, H2 } from '@theme/ui/Typography';
|
|
5
|
+
import { Background } from '@theme/ui/Background';
|
|
6
|
+
|
|
7
|
+
export const Jumbotron = styled(Background).attrs(() => ({
|
|
8
|
+
'data-component-name': 'ui/Jumbotron',
|
|
9
|
+
}))<{
|
|
10
|
+
pt?: string;
|
|
11
|
+
pb?: string;
|
|
12
|
+
pl?: string;
|
|
13
|
+
pr?: string;
|
|
14
|
+
bgImage?: string;
|
|
15
|
+
bgColor?: string;
|
|
16
|
+
parallaxEffect?: boolean;
|
|
17
|
+
textColor?: string;
|
|
18
|
+
}>`
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
padding-top: ${({ pt }) => pt || '0'};
|
|
21
|
+
padding-bottom: ${({ pb }) => pb || '8em'};
|
|
22
|
+
padding-left: ${({ pl }) => pl || '0'};
|
|
23
|
+
padding-right: ${({ pr }) => pr || '0'};
|
|
24
|
+
${({ bgColor }) => bgColor && `background: ${bgColor}`};
|
|
25
|
+
${({ bgImage, bgColor }) =>
|
|
26
|
+
bgImage &&
|
|
27
|
+
`
|
|
28
|
+
background: ${bgColor || 'var(--color-primary-main)'} url(${bgImage});
|
|
29
|
+
background-repeat: no-repeat;
|
|
30
|
+
background-size: cover;
|
|
31
|
+
background-position: center;
|
|
32
|
+
`};
|
|
33
|
+
${({ parallaxEffect }) =>
|
|
34
|
+
parallaxEffect &&
|
|
35
|
+
`
|
|
36
|
+
background-attachment: scroll, fixed;
|
|
37
|
+
`};
|
|
38
|
+
${space}
|
|
39
|
+
${H1}, ${H2} {
|
|
40
|
+
color: ${({ textColor }) => textColor || 'var(--navbar-color-text)'};
|
|
41
|
+
text-align: center;
|
|
42
|
+
padding: 0;
|
|
43
|
+
}
|
|
44
|
+
h1 {
|
|
45
|
+
font-size: 3.5em;
|
|
46
|
+
line-height: 1.2;
|
|
47
|
+
font-weight: var(--font-weight-bold);
|
|
48
|
+
margin: 1.75em 0 0.5em 0;
|
|
49
|
+
}
|
|
50
|
+
h2 {
|
|
51
|
+
font-size: 1.875em;
|
|
52
|
+
line-height: 1;
|
|
53
|
+
font-weight: var(--font-weight-light);
|
|
54
|
+
margin: 0;
|
|
55
|
+
margin-bottom: 2em;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { Component, CSSProperties } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Link } from '@portal/Link';
|
|
5
|
+
import { Flex } from '@theme/ui/Flex';
|
|
6
|
+
import { TileText } from '@theme/ui/Tiles/TileText';
|
|
7
|
+
import { TileHeader } from '@theme/ui/Tiles/TileHeader';
|
|
8
|
+
|
|
9
|
+
type TextAlign = 'left' | 'right' | 'center' | 'justify';
|
|
10
|
+
|
|
11
|
+
export interface TileProps {
|
|
12
|
+
header?: string;
|
|
13
|
+
icon?: string;
|
|
14
|
+
children?: string;
|
|
15
|
+
to?: string;
|
|
16
|
+
target?: string;
|
|
17
|
+
headerAlign?: TextAlign;
|
|
18
|
+
textAlign?: TextAlign;
|
|
19
|
+
bgColor?: string;
|
|
20
|
+
bgImage?: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
maxWidth?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ThinTileWrapper = styled(Link)<{ bgColor?: string; bgImage?: string }>`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
border-radius: 10px;
|
|
31
|
+
box-shadow: 0px 10px 30px 0px rgba(35, 35, 35, 0.1);
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
transition: box-shadow 0.25s ease;
|
|
34
|
+
padding: 24px;
|
|
35
|
+
margin-bottom: 20px;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
width: 100%;
|
|
38
|
+
background-color: ${({ bgColor }) => bgColor || '#fff'};
|
|
39
|
+
background-image: ${({ bgImage }) => (bgImage ? `url(${bgImage})` : 'none')};
|
|
40
|
+
background-repeat: no-repeat;
|
|
41
|
+
|
|
42
|
+
:hover {
|
|
43
|
+
box-shadow: 0px 10px 100px 0px rgba(35, 35, 35, 0.2);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
47
|
+
width: calc(50% - 20px);
|
|
48
|
+
margin-right: 10px;
|
|
49
|
+
margin-left: 10px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
53
|
+
width: 250px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
${({ theme }) => theme.mediaQueries.large} {
|
|
57
|
+
width: 280px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.external-url {
|
|
61
|
+
:after {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const ThinTileIcon = styled.img`
|
|
68
|
+
width: 90px;
|
|
69
|
+
|
|
70
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
71
|
+
width: 80px;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const ThinTileHeader = styled(TileHeader)<{ align?: TextAlign }>`
|
|
76
|
+
font-size: 24px;
|
|
77
|
+
text-align: ${({ align }) => align || 'center'};
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
const ThinTileText = styled(TileText)<{ icon?: string; align?: TextAlign }>`
|
|
81
|
+
font-size: 18px;
|
|
82
|
+
line-height: 1.5;
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
min-height: 3em;
|
|
85
|
+
text-align: ${({ align }) => align || 'center'};
|
|
86
|
+
${({ icon }) =>
|
|
87
|
+
icon
|
|
88
|
+
? `
|
|
89
|
+
display: -webkit-box;
|
|
90
|
+
-webkit-line-clamp: 8;
|
|
91
|
+
-webkit-box-orient: vertical;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
line-clamp: 8;
|
|
94
|
+
`
|
|
95
|
+
: ''};
|
|
96
|
+
${({ theme }) => theme.mediaQueries.small} {
|
|
97
|
+
min-height: 6em;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
101
|
+
min-height: 4.5em;
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
export class ThinTile extends Component<TileProps> {
|
|
106
|
+
render(): JSX.Element {
|
|
107
|
+
const { header, icon, children, to, target, headerAlign, textAlign, color, className, style } =
|
|
108
|
+
this.props;
|
|
109
|
+
|
|
110
|
+
const Wrapper = to
|
|
111
|
+
? ThinTileWrapper
|
|
112
|
+
: (ThinTileWrapper.withComponent('div') as typeof ThinTileWrapper);
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<Wrapper
|
|
116
|
+
to={to}
|
|
117
|
+
target={target}
|
|
118
|
+
color={color}
|
|
119
|
+
className={className}
|
|
120
|
+
style={style}
|
|
121
|
+
data-component-name="ui/Tiles/ThinTile"
|
|
122
|
+
>
|
|
123
|
+
{(icon || header) && (
|
|
124
|
+
<Flex flexDirection="column">
|
|
125
|
+
{icon && (
|
|
126
|
+
<Flex
|
|
127
|
+
flexShrink={0}
|
|
128
|
+
height={{ xs: 'auto', small: '100px', medium: '110px' }}
|
|
129
|
+
alignItems="center"
|
|
130
|
+
justifyContent="center"
|
|
131
|
+
mb="25px"
|
|
132
|
+
>
|
|
133
|
+
<ThinTileIcon src={icon} />
|
|
134
|
+
</Flex>
|
|
135
|
+
)}
|
|
136
|
+
{header && (
|
|
137
|
+
<ThinTileHeader align={headerAlign} color={color} data-cy={`Thin-${header}`}>
|
|
138
|
+
{header}
|
|
139
|
+
</ThinTileHeader>
|
|
140
|
+
)}
|
|
141
|
+
</Flex>
|
|
142
|
+
)}
|
|
143
|
+
{children && (
|
|
144
|
+
<ThinTileText icon={icon} align={textAlign} color={color}>
|
|
145
|
+
{children}
|
|
146
|
+
</ThinTileText>
|
|
147
|
+
)}
|
|
148
|
+
</Wrapper>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const TileHeader = styled.h3.attrs(() => ({
|
|
4
|
+
'data-component-name': 'ui/Tiles/TileHeader',
|
|
5
|
+
}))<{ color?: string }>`
|
|
6
|
+
font-weight: var(--font-weight-bold);
|
|
7
|
+
line-height: 1.25;
|
|
8
|
+
color: ${(props) => props.color || 'var(--color-primary-main)'};
|
|
9
|
+
font-family: var(--h-font-family);
|
|
10
|
+
&& {
|
|
11
|
+
margin: 0 0 0.5em;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const TileText = styled.span.attrs(() => ({
|
|
4
|
+
'data-component-name': 'ui/Tiles/TileText',
|
|
5
|
+
}))<{ color?: string }>`
|
|
6
|
+
display: inline-block;
|
|
7
|
+
font-weight: var(--font-weight-regular);
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
color: ${(props) => props.color || 'var(--color-text-main)'};
|
|
10
|
+
line-height: 1.25;
|
|
11
|
+
font-family: var(--font-family-primary);
|
|
12
|
+
`;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Link } from '@portal/Link';
|
|
5
|
+
import { TileProps } from '@theme/ui';
|
|
6
|
+
import { TileText } from '@theme/ui/Tiles/TileText';
|
|
7
|
+
import { TileHeader } from '@theme/ui/Tiles/TileHeader';
|
|
8
|
+
|
|
9
|
+
// prettier-ignore
|
|
10
|
+
const WideTileWrapper = styled(Link)<{
|
|
11
|
+
disableArrow?: boolean;
|
|
12
|
+
withIcon: boolean;
|
|
13
|
+
bgColor?: string;
|
|
14
|
+
bgImage?: string;
|
|
15
|
+
color?: string;
|
|
16
|
+
maxWidth?: string;
|
|
17
|
+
}>`
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
flex-direction: ${({ withIcon }) => (withIcon ? 'column' : 'row')};
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
box-shadow: 0px 10px 30px 0px rgba(35, 35, 35, 0.1);
|
|
22
|
+
background-color: ${({ bgColor }) => bgColor || '#fff'};
|
|
23
|
+
background-image: ${({ bgImage }) => (bgImage ? `url(${bgImage})` : 'none')};
|
|
24
|
+
background-repeat: no-repeat;
|
|
25
|
+
padding: 24px;
|
|
26
|
+
padding-right: ${({ disableArrow }) => (disableArrow ? '24px' : '56px')};
|
|
27
|
+
margin-bottom: 32px;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
position: relative;
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
width: 100%;
|
|
32
|
+
transition: box-shadow 0.25s ease;
|
|
33
|
+
:hover {
|
|
34
|
+
box-shadow: 0px 10px 30px 0px rgba(35, 35, 35, 0.2);
|
|
35
|
+
}
|
|
36
|
+
:before {
|
|
37
|
+
content: ${({ disableArrow }) => (disableArrow ? 'none' : '""')};
|
|
38
|
+
display: inline-block;
|
|
39
|
+
width: 9px;
|
|
40
|
+
min-height: 18px;
|
|
41
|
+
background-size: 9px 18px;
|
|
42
|
+
background-repeat: no-repeat;
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 50%;
|
|
45
|
+
transform: translateY(-50%);
|
|
46
|
+
right: 30px;
|
|
47
|
+
}
|
|
48
|
+
&.external-url::after {
|
|
49
|
+
content: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
53
|
+
width: calc(50% - 2em);
|
|
54
|
+
padding: 32px;
|
|
55
|
+
padding-right: ${({ disableArrow }) => (disableArrow ? '32px' : '64px')};
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
max-width: ${({ maxWidth }) => maxWidth};
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
const WideTileHeader = styled(TileHeader)<{ align?: string }>`
|
|
62
|
+
font-size: 24px;
|
|
63
|
+
text-align: ${({ align }) => align || 'left'};
|
|
64
|
+
`;
|
|
65
|
+
const WideTileText = styled(TileText)<{ align?: string }>`
|
|
66
|
+
font-size: 18px;
|
|
67
|
+
text-align: ${({ align }) => align || 'left'};
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
const WideTileIcon = styled.div`
|
|
71
|
+
margin-bottom: 24px;
|
|
72
|
+
flex-shrink: 0;
|
|
73
|
+
width: 70px;
|
|
74
|
+
img {
|
|
75
|
+
display: block;
|
|
76
|
+
height: auto;
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
81
|
+
margin-right: 24px;
|
|
82
|
+
margin-bottom: 0;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
export class WideTile extends Component<TileProps & { disableArrow?: boolean }> {
|
|
87
|
+
render(): JSX.Element {
|
|
88
|
+
const {
|
|
89
|
+
to,
|
|
90
|
+
header,
|
|
91
|
+
children,
|
|
92
|
+
target,
|
|
93
|
+
disableArrow,
|
|
94
|
+
textAlign,
|
|
95
|
+
headerAlign,
|
|
96
|
+
icon,
|
|
97
|
+
bgColor,
|
|
98
|
+
bgImage,
|
|
99
|
+
color,
|
|
100
|
+
className,
|
|
101
|
+
style,
|
|
102
|
+
maxWidth,
|
|
103
|
+
} = this.props;
|
|
104
|
+
return (
|
|
105
|
+
<WideTileWrapper
|
|
106
|
+
to={to}
|
|
107
|
+
target={target}
|
|
108
|
+
disableArrow={disableArrow}
|
|
109
|
+
withIcon={!!icon}
|
|
110
|
+
bgColor={bgColor}
|
|
111
|
+
bgImage={bgImage}
|
|
112
|
+
color={color}
|
|
113
|
+
className={className}
|
|
114
|
+
style={style}
|
|
115
|
+
maxWidth={maxWidth}
|
|
116
|
+
data-component-name="ui/Tiles/WideTile"
|
|
117
|
+
>
|
|
118
|
+
{icon && (
|
|
119
|
+
<WideTileIcon>
|
|
120
|
+
<img src={icon} alt="" />
|
|
121
|
+
</WideTileIcon>
|
|
122
|
+
)}
|
|
123
|
+
<div>
|
|
124
|
+
{header && (
|
|
125
|
+
<WideTileHeader align={textAlign} color={color} data-cy={`Wide-${header}`}>
|
|
126
|
+
{header}
|
|
127
|
+
</WideTileHeader>
|
|
128
|
+
)}
|
|
129
|
+
{children && (
|
|
130
|
+
<WideTileText align={headerAlign} color={color}>
|
|
131
|
+
{children}
|
|
132
|
+
</WideTileText>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
</WideTileWrapper>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import styled, { css, SimpleInterpolation } from 'styled-components';
|
|
2
|
+
import { color, typography as typographySystem, ColorProps, TypographyProps } from 'styled-system';
|
|
3
|
+
|
|
4
|
+
export interface ITypography {
|
|
5
|
+
fontSize?: string;
|
|
6
|
+
fontWeight?: string | number;
|
|
7
|
+
fontFamily?: string;
|
|
8
|
+
lineHeight?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
transform?: string;
|
|
11
|
+
marginTop?: string;
|
|
12
|
+
marginRight?: string;
|
|
13
|
+
marginLeft?: string;
|
|
14
|
+
marginBottom?: string;
|
|
15
|
+
marginVertical?: string;
|
|
16
|
+
marginHorizontal?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const typographyTokens = {
|
|
20
|
+
typography: {
|
|
21
|
+
fontSize: 'var(--font-size-base)',
|
|
22
|
+
fontFamily: 'var(--font-family-h)',
|
|
23
|
+
lineHeight: 'var(--line-height-m)',
|
|
24
|
+
},
|
|
25
|
+
heading1: {
|
|
26
|
+
fontSize: 'var(--h1-font-size)',
|
|
27
|
+
fontFamily: 'var(--font-family-h)',
|
|
28
|
+
fontWeight: 'var(--font-weight-bold)',
|
|
29
|
+
lineHeight: 'var(--h1-line-height)',
|
|
30
|
+
color: 'var(--color-text-main)',
|
|
31
|
+
marginTop: 'var(--h1-margin-top)',
|
|
32
|
+
marginBottom: 'var(--h1-margin-bottom)',
|
|
33
|
+
},
|
|
34
|
+
heading2: {
|
|
35
|
+
fontSize: 'var(--h2-font-size)',
|
|
36
|
+
fontFamily: 'var(--font-family-h)',
|
|
37
|
+
fontWeight: 'var(--font-weight-bold)',
|
|
38
|
+
lineHeight: 'var(--h2-line-height)',
|
|
39
|
+
color: 'var(--color-text-main)',
|
|
40
|
+
marginTop: 'var(--h2-margin-top)',
|
|
41
|
+
marginBottom: 'var(--h2-margin-bottom)',
|
|
42
|
+
},
|
|
43
|
+
heading3: {
|
|
44
|
+
fontSize: 'var(--h3-font-size)',
|
|
45
|
+
fontFamily: 'var(--font-family-h)',
|
|
46
|
+
fontWeight: 'var(--font-weight-bold)',
|
|
47
|
+
lineHeight: 'var(--h3-line-height)',
|
|
48
|
+
color: 'var(--color-text-main)',
|
|
49
|
+
marginTop: 'var(--h3-margin-top)',
|
|
50
|
+
marginBottom: 'var(--h3-margin-bottom)',
|
|
51
|
+
},
|
|
52
|
+
heading4: {},
|
|
53
|
+
heading5: {},
|
|
54
|
+
heading6: {},
|
|
55
|
+
blockquote: {
|
|
56
|
+
color: 'var(--color-text-main)',
|
|
57
|
+
},
|
|
58
|
+
alert: {
|
|
59
|
+
fontSize: 'var(--alert-font-size)',
|
|
60
|
+
fontWeight: 'var(--alert-font-weight)',
|
|
61
|
+
lineHeight: 'var(--alert-line-height)',
|
|
62
|
+
marginTop: 'var(--alert-margin-vertical)',
|
|
63
|
+
marginBottom: 'var(-alert-margin-vartical)',
|
|
64
|
+
heading: {
|
|
65
|
+
fontSize: 'var(--alert-heading-font-size)',
|
|
66
|
+
fontWeight: 'var(--alert-heading-font-weight)',
|
|
67
|
+
lineHeight: 'var(--alert-line-height)',
|
|
68
|
+
transform: 'var(--alert-heading-transform)',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export function typography(theme?: ITypography): string | SimpleInterpolation {
|
|
74
|
+
if (!theme) return '';
|
|
75
|
+
return css`
|
|
76
|
+
font-size: ${theme.fontSize || ''};
|
|
77
|
+
font-weight: ${theme.fontWeight || ''};
|
|
78
|
+
font-family: ${theme.fontFamily || ''};
|
|
79
|
+
line-height: ${theme.lineHeight || ''};
|
|
80
|
+
color: ${theme.color || ''};
|
|
81
|
+
text-transform: ${theme.transform || ''};
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type HeadingProps = TypographyProps &
|
|
86
|
+
ColorProps & {
|
|
87
|
+
mt?: string;
|
|
88
|
+
mb?: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Emphasis = styled.strong.attrs(() => ({
|
|
92
|
+
'data-component-name': 'ui/Typography/Emphasis',
|
|
93
|
+
}))`
|
|
94
|
+
font-weight: var(--font-weight-bold);
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
export const H1 = styled.h1.attrs(() => ({
|
|
98
|
+
'data-component-name': 'ui/Typography/H1',
|
|
99
|
+
}))<HeadingProps>`
|
|
100
|
+
${typography(typographyTokens.heading1)};
|
|
101
|
+
margin: 1.35em 0 0.9em;
|
|
102
|
+
&& {
|
|
103
|
+
${({ mt }) => mt && `margin-top: ${mt};`}
|
|
104
|
+
${({ mb }) => mb && `margin-bottom: ${mb};`}
|
|
105
|
+
${color}
|
|
106
|
+
${typographySystem}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
export const H2 = styled.h1.attrs(() => ({
|
|
111
|
+
'data-component-name': 'ui/Typography/H2',
|
|
112
|
+
}))<HeadingProps>`
|
|
113
|
+
${typography(typographyTokens.heading2)};
|
|
114
|
+
margin: 1.25em 0 0.8em;
|
|
115
|
+
&& {
|
|
116
|
+
${({ mt }) => mt && `margin-top: ${mt};`}
|
|
117
|
+
${({ mb }) => mb && `margin-bottom: ${mb};`}
|
|
118
|
+
${color}
|
|
119
|
+
${typographySystem}
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
export const H3 = styled.h1.attrs(() => ({
|
|
124
|
+
'data-component-name': 'ui/Typography/H3',
|
|
125
|
+
}))<HeadingProps>`
|
|
126
|
+
${typography(typographyTokens.heading3)};
|
|
127
|
+
margin: 1.25em 0 0.8em;
|
|
128
|
+
&& {
|
|
129
|
+
${({ mt }) => mt && `margin-top: ${mt};`}
|
|
130
|
+
${({ mb }) => mb && `margin-bottom: ${mb};`}
|
|
131
|
+
${color}
|
|
132
|
+
${typographySystem}
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
export const SectionHeader = styled.h2`
|
|
137
|
+
color: var(--color-primary-main);
|
|
138
|
+
font-size: 1.75em;
|
|
139
|
+
font-weight: var(--font-weight-light);
|
|
140
|
+
text-align: center;
|
|
141
|
+
margin: 2.65em 0;
|
|
142
|
+
padding: 0px 20px;
|
|
143
|
+
font-family: var(--font-family-h);
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
export const Typography = styled.p.attrs(() => ({
|
|
147
|
+
'data-component-name': 'ui/Typography/Typography',
|
|
148
|
+
}))<
|
|
149
|
+
TypographyProps & {
|
|
150
|
+
color?: string;
|
|
151
|
+
mt?: string;
|
|
152
|
+
mb?: string;
|
|
153
|
+
}
|
|
154
|
+
>`
|
|
155
|
+
${typography(typographyTokens.typography)};
|
|
156
|
+
color: var(--color-text-main);
|
|
157
|
+
${color}
|
|
158
|
+
margin-top: ${({ mt }) => mt || '1em'};
|
|
159
|
+
margin-bottom: ${({ mb }) => mb || '1em'};
|
|
160
|
+
${typographySystem}
|
|
161
|
+
`;
|
|
162
|
+
|
|
163
|
+
export const CompactTypography = styled(Typography).attrs(() => ({
|
|
164
|
+
mt: '0em',
|
|
165
|
+
mb: '0em',
|
|
166
|
+
'data-component-name': 'ui/Typography/CompactTypography',
|
|
167
|
+
}))``;
|