@redocly/theme 0.4.8 → 0.4.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/Button.d.ts +2 -2
- package/Button/Button.js +7 -3
- package/Cards/Card.js +6 -13
- package/ColorModeSwitcher/ColorModeSwitcher.js +29 -18
- package/CopyButton/CopyButton.js +24 -13
- package/CopyButton/CopyButtonWrapper.d.ts +2 -2
- package/CopyButton/CopyButtonWrapper.js +25 -13
- package/EditPageButton/EditPageButton.js +4 -13
- package/Footer/CustomFooter.js +6 -15
- package/Footer/CustomFooterNavItem.js +4 -13
- package/Footer/Footer.js +6 -16
- package/Footer/FooterColumn.js +9 -18
- package/Footer/FooterColumns.js +3 -13
- package/Footer/FooterCopyright.js +2 -13
- package/JsonViewer/JsonViewer.d.ts +3 -3
- package/JsonViewer/JsonViewer.js +33 -16
- package/LastUpdated/LastUpdated.js +6 -16
- package/Layout/PageLayout.d.ts +3 -3
- package/Layout/PageLayout.js +4 -13
- package/Layout/RootLayout.d.ts +4 -4
- package/Layout/RootLayout.js +5 -13
- package/Markdown/Admonition.d.ts +2 -2
- package/Markdown/Admonition.js +5 -13
- package/Markdown/CodeSample/CodeSample.d.ts +1 -2
- package/Markdown/CodeSample/CodeSample.js +18 -4
- package/Markdown/Details.d.ts +2 -2
- package/Markdown/Details.js +4 -2
- package/Markdown/Heading.js +29 -15
- package/Markdown/MarkdownLayout.d.ts +3 -3
- package/Markdown/MarkdownLayout.js +9 -13
- package/Markdown/Mermaid.js +2 -2
- package/Markdown/Sup.js +2 -13
- package/Markdown/Tabs/Tab.js +2 -13
- package/Markdown/Tabs/Tabs.js +34 -21
- package/Navbar/MobileNavbarDropdown.js +3 -13
- package/Navbar/MobileNavbarItem.js +31 -14
- package/Navbar/MobileNavbarMenu.js +6 -15
- package/Navbar/Navbar.d.ts +4 -4
- package/Navbar/Navbar.js +12 -16
- package/Navbar/NavbarDropdown.js +3 -13
- package/Navbar/NavbarItem.js +8 -14
- package/Navbar/NavbarMenu.js +4 -15
- package/NavbarLogo/NavbarLogo.js +3 -14
- package/PageNavigation/NextPageLink.js +5 -16
- package/PageNavigation/PageNavigation.js +6 -16
- package/PageNavigation/PreviousPageLink.js +5 -16
- package/Panel/PanelComponent.d.ts +2 -1
- package/Panel/PanelComponent.js +31 -14
- package/Profile/Profile.d.ts +2 -2
- package/Profile/Profile.js +9 -15
- package/Search/Autocomplete.js +30 -3
- package/Search/ClearIcon.js +3 -2
- package/Search/Parameters.js +17 -17
- package/Search/Search.js +3 -13
- package/Search/SearchIcon.js +3 -2
- package/Search/SearchItem.js +30 -13
- package/Search/utils.js +28 -2
- package/Sidebar/ApiCallItem.js +7 -13
- package/Sidebar/ArrowBack.js +5 -13
- package/Sidebar/BackButton.d.ts +2 -2
- package/Sidebar/BackButton.js +4 -13
- package/Sidebar/Drilldown.d.ts +2 -2
- package/Sidebar/Drilldown.js +6 -2
- package/Sidebar/DrilldownMenu.d.ts +2 -2
- package/Sidebar/DrilldownMenu.js +10 -13
- package/Sidebar/DrilldownMenuItem.js +6 -13
- package/Sidebar/ExternalIcon.js +7 -13
- package/Sidebar/MenuGroup.d.ts +2 -2
- package/Sidebar/MenuGroup.js +8 -13
- package/Sidebar/MenuItem.js +7 -13
- package/Sidebar/MenuLinkItem.d.ts +2 -2
- package/Sidebar/MenuLinkItem.js +2 -2
- package/Sidebar/Separator.js +4 -13
- package/Sidebar/SidebarLayout.d.ts +3 -3
- package/Sidebar/SidebarLayout.js +9 -16
- package/SidebarLogo/SidebarLogo.js +3 -14
- package/SourceCode/SourceCode.js +31 -18
- package/TableOfContent/TableOfContent.js +36 -23
- package/Tooltip/Tooltip.d.ts +2 -1
- package/Tooltip/Tooltip.js +4 -3
- package/globalStyle.js +10 -9
- package/hooks/useDefaultThemeSettings.d.ts +2 -0
- package/hooks/useDefaultThemeSettings.js +9 -0
- package/icons/AlertIcon/AlertIcon.js +20 -17
- package/icons/ArrowIcon/ArrowIcon.js +4 -13
- package/icons/ColorModeIcon/ColorModeIcon.js +7 -15
- package/icons/ShelfIcon/ShelfIcon.d.ts +2 -2
- package/icons/ShelfIcon/ShelfIcon.js +4 -13
- package/mocks/Link.js +5 -2
- package/mocks/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/Button/Button.tsx +2 -2
- package/src/Cards/Card.tsx +1 -0
- package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +3 -4
- package/src/CopyButton/CopyButton.tsx +1 -1
- package/src/CopyButton/CopyButtonWrapper.tsx +1 -1
- package/src/EditPageButton/EditPageButton.tsx +1 -0
- package/src/Footer/CustomFooter.tsx +1 -0
- package/src/Footer/CustomFooterNavItem.tsx +1 -0
- package/src/Footer/Footer.tsx +3 -3
- package/src/Footer/FooterColumn.tsx +1 -0
- package/src/Footer/FooterColumns.tsx +1 -0
- package/src/Footer/FooterCopyright.tsx +1 -0
- package/src/JsonViewer/JsonViewer.tsx +1 -1
- package/src/LastUpdated/LastUpdated.tsx +3 -3
- package/src/Layout/PageLayout.tsx +6 -3
- package/src/Layout/RootLayout.tsx +4 -4
- package/src/Markdown/Admonition.tsx +2 -2
- package/src/Markdown/CodeSample/CodeSample.tsx +24 -7
- package/src/Markdown/Details.tsx +2 -2
- package/src/Markdown/Heading.tsx +1 -1
- package/src/Markdown/MarkdownLayout.tsx +3 -3
- package/src/Markdown/Mermaid.tsx +1 -0
- package/src/Markdown/Sup.tsx +1 -0
- package/src/Markdown/Tabs/Tab.tsx +1 -0
- package/src/Markdown/Tabs/Tabs.tsx +2 -1
- package/src/Navbar/MobileNavbarDropdown.tsx +1 -0
- package/src/Navbar/MobileNavbarItem.tsx +1 -1
- package/src/Navbar/MobileNavbarMenu.tsx +1 -0
- package/src/Navbar/Navbar.tsx +6 -7
- package/src/Navbar/NavbarDropdown.tsx +1 -0
- package/src/Navbar/NavbarItem.tsx +1 -0
- package/src/Navbar/NavbarMenu.tsx +1 -0
- package/src/NavbarLogo/NavbarLogo.tsx +1 -0
- package/src/PageNavigation/NextPageLink.tsx +4 -3
- package/src/PageNavigation/PageNavigation.tsx +3 -3
- package/src/PageNavigation/PreviousPageLink.tsx +4 -3
- package/src/Panel/PanelComponent.tsx +2 -2
- package/src/Profile/Profile.tsx +1 -1
- package/src/Search/Autocomplete.tsx +1 -1
- package/src/Search/ClearIcon.tsx +1 -0
- package/src/Search/Parameters.tsx +1 -0
- package/src/Search/Search.tsx +1 -0
- package/src/Search/SearchIcon.tsx +1 -0
- package/src/Search/SearchItem.tsx +1 -1
- package/src/Search/utils.tsx +1 -0
- package/src/Sidebar/ApiCallItem.tsx +1 -0
- package/src/Sidebar/ArrowBack.tsx +1 -0
- package/src/Sidebar/BackButton.tsx +5 -2
- package/src/Sidebar/Drilldown.tsx +2 -2
- package/src/Sidebar/DrilldownMenu.tsx +2 -2
- package/src/Sidebar/DrilldownMenuItem.tsx +1 -0
- package/src/Sidebar/ExternalIcon.tsx +1 -0
- package/src/Sidebar/MenuGroup.tsx +2 -2
- package/src/Sidebar/MenuItem.tsx +1 -0
- package/src/Sidebar/MenuLinkItem.tsx +5 -2
- package/src/Sidebar/Separator.tsx +1 -0
- package/src/Sidebar/SidebarLayout.tsx +5 -6
- package/src/SidebarLogo/SidebarLogo.tsx +1 -0
- package/src/SourceCode/SourceCode.tsx +1 -1
- package/src/TableOfContent/TableOfContent.tsx +3 -4
- package/src/Tooltip/Tooltip.tsx +1 -1
- package/src/globalStyle.ts +54 -0
- package/src/hooks/useDefaultThemeSettings.ts +8 -0
- package/src/icons/AlertIcon/AlertIcon.tsx +1 -0
- package/src/icons/ArrowIcon/ArrowIcon.tsx +1 -0
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +1 -0
- package/src/icons/ShelfIcon/ShelfIcon.tsx +2 -2
- package/src/mocks/Link.tsx +1 -0
- package/src/mocks/types.ts +4 -0
- package/src/types/portal/src/shared/types.d.ts +1 -2
- package/src/ui/Burger.tsx +1 -0
- package/src/ui/Dropdown.tsx +1 -1
- package/src/ui/Flex.tsx +2 -2
- package/src/ui/Tiles/ThinTile.tsx +1 -1
- package/src/ui/Tiles/WideTile.tsx +1 -1
- package/src/ui/UniversalLink.tsx +10 -9
- package/src/ui/index.tsx +3 -2
- package/ui/Burger.js +5 -13
- package/ui/Dropdown.js +32 -14
- package/ui/Flex.d.ts +2 -2
- package/ui/Flex.js +2 -2
- package/ui/Tiles/ThinTile.js +29 -13
- package/ui/Tiles/WideTile.js +29 -13
- package/ui/UniversalLink.d.ts +4 -4
- package/ui/UniversalLink.js +26 -3
- package/ui/index.d.ts +3 -3
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface PageLayoutProps {
|
|
5
|
-
sidebar?: ReactNode;
|
|
5
|
+
sidebar?: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export function PageLayout({
|
|
8
|
+
export function PageLayout({
|
|
9
|
+
sidebar,
|
|
10
|
+
children,
|
|
11
|
+
}: React.PropsWithChildren<PageLayoutProps>): JSX.Element {
|
|
9
12
|
return (
|
|
10
13
|
<Container data-component-name="Layout/PageLayout">
|
|
11
14
|
{sidebar}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface LayoutConfig {
|
|
5
|
-
navbar: ReactNode;
|
|
6
|
-
footer: ReactNode;
|
|
5
|
+
navbar: React.ReactNode;
|
|
6
|
+
footer: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const Wrapper = styled.div``;
|
|
@@ -12,7 +12,7 @@ export function RootLayout({
|
|
|
12
12
|
navbar,
|
|
13
13
|
footer,
|
|
14
14
|
children,
|
|
15
|
-
}: PropsWithChildren<LayoutConfig>): JSX.Element {
|
|
15
|
+
}: React.PropsWithChildren<LayoutConfig>): JSX.Element {
|
|
16
16
|
return (
|
|
17
17
|
// TODO: rewrite it to avoid passing components as props
|
|
18
18
|
<Wrapper data-component-name="Layout/RootLayout">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import { AlertIcon } from '@theme/icons/AlertIcon/AlertIcon';
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ export function Admonition({
|
|
|
15
15
|
type = 'info',
|
|
16
16
|
name,
|
|
17
17
|
children,
|
|
18
|
-
}: PropsWithChildren<AdmonitionProps>): JSX.Element {
|
|
18
|
+
}: React.PropsWithChildren<AdmonitionProps>): JSX.Element {
|
|
19
19
|
return (
|
|
20
20
|
<Wrapper type={type} data-component-name="Markdown/Admonition">
|
|
21
21
|
<AlertIcon type={type} />
|
|
@@ -1,31 +1,48 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { ClipboardService } from '@theme/utils/ClipboardService';
|
|
5
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
5
6
|
|
|
6
|
-
type CodeSampleProps = {
|
|
7
|
+
export type CodeSampleProps = {
|
|
7
8
|
language: string;
|
|
8
9
|
highlighted: string;
|
|
9
10
|
rawContent: string;
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
const defaultCopyCodeSnippet = {
|
|
14
|
+
hide: false,
|
|
15
|
+
buttonText: 'Copy',
|
|
16
|
+
tooltipText: 'Copy the code snippet',
|
|
17
|
+
toasterText: 'Copied',
|
|
18
|
+
toasterDuration: 1500,
|
|
19
|
+
};
|
|
20
|
+
|
|
12
21
|
export function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element {
|
|
13
22
|
const langClassName = language ? `language-${language}` : '';
|
|
23
|
+
const { copyCodeSnippet } = useDefaultThemeSettings();
|
|
24
|
+
const copyCodeProps = { ...copyCodeSnippet, ...defaultCopyCodeSnippet };
|
|
14
25
|
|
|
15
26
|
const [isCopied, setIsCopied] = useState(false);
|
|
16
27
|
|
|
17
28
|
const copyCode = (code: string) => {
|
|
18
29
|
ClipboardService.copyCustom(code);
|
|
19
30
|
setIsCopied(true);
|
|
20
|
-
setTimeout(() => setIsCopied(false),
|
|
31
|
+
setTimeout(() => setIsCopied(false), copyCodeProps.toasterDuration);
|
|
21
32
|
};
|
|
22
33
|
|
|
23
34
|
return (
|
|
24
35
|
<Wrapper className="code-sample" data-component-name="Markdown/CodeSample/CodeSample">
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
{!copyCodeProps.hide && (
|
|
37
|
+
<CodeSampleButtonContainer onClick={() => copyCode(rawContent)}>
|
|
38
|
+
{!isCopied && (
|
|
39
|
+
<CopyCodeButton title={copyCodeProps.tooltipText}>
|
|
40
|
+
{copyCodeProps.buttonText}
|
|
41
|
+
</CopyCodeButton>
|
|
42
|
+
)}
|
|
43
|
+
{isCopied && <DoneIndicator>{copyCodeProps.toasterText}</DoneIndicator>}
|
|
44
|
+
</CodeSampleButtonContainer>
|
|
45
|
+
)}
|
|
29
46
|
<pre className={langClassName}>
|
|
30
47
|
<code className={langClassName} dangerouslySetInnerHTML={{ __html: highlighted }} />
|
|
31
48
|
</pre>
|
package/src/Markdown/Details.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
type DetailsProps = {
|
|
5
5
|
summary: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export function Details({ summary, children }: PropsWithChildren<DetailsProps>): JSX.Element {
|
|
8
|
+
export function Details({ summary, children }: React.PropsWithChildren<DetailsProps>): JSX.Element {
|
|
9
9
|
return (
|
|
10
10
|
<StyledDetails>
|
|
11
11
|
<summary>{summary}</summary>
|
package/src/Markdown/Heading.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import { PageWrapper } from '@theme/Markdown/PageWrapper';
|
|
5
5
|
import { ContainerWrapper } from '@theme/Markdown/ContainerWrapper';
|
|
@@ -8,8 +8,8 @@ import { EditPageButton } from '@theme/EditPageButton';
|
|
|
8
8
|
import { LastUpdated } from '@theme/LastUpdated/LastUpdated';
|
|
9
9
|
|
|
10
10
|
type MarkdownLayoutProps = {
|
|
11
|
-
tableOfContent: ReactNode;
|
|
12
|
-
markdownWrapper: ReactNode;
|
|
11
|
+
tableOfContent: React.ReactNode;
|
|
12
|
+
markdownWrapper: React.ReactNode;
|
|
13
13
|
showPrevButton?: boolean;
|
|
14
14
|
showNextButton?: boolean;
|
|
15
15
|
editPage?: {
|
package/src/Markdown/Mermaid.tsx
CHANGED
package/src/Markdown/Sup.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import { Tab } from '@theme/Markdown/Tabs/Tab';
|
|
@@ -39,6 +39,7 @@ const TabList = styled.ol`
|
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
41
|
const TabContent = styled.div`
|
|
42
|
+
padding: 10px 5px;
|
|
42
43
|
border: 1px solid #ccc;
|
|
43
44
|
border-top: none;
|
|
44
45
|
padding: 1rem;
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ResolvedConfigLinks } from '@theme/types/portal';
|
|
5
5
|
|
|
6
|
-
import { useThemeSettings } from '@portal/hooks';
|
|
7
|
-
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
8
6
|
import { NavbarMenu } from '@theme/Navbar';
|
|
9
7
|
import { useMobileMenu } from '@theme/hooks/useMobileMenu';
|
|
10
8
|
import { MobileNavbarMenuButton } from '@theme/Navbar/MobileNavbarMenuButton';
|
|
11
9
|
import { MobileNavbarMenu } from '@theme/Navbar/MobileNavbarMenu';
|
|
12
10
|
import { ColorModeSwitcher } from '@theme/ColorModeSwitcher/ColorModeSwitcher';
|
|
11
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
13
12
|
|
|
14
13
|
interface NavbarProps {
|
|
15
14
|
menu: ResolvedConfigLinks;
|
|
16
|
-
logo: ReactNode;
|
|
17
|
-
search: ReactNode;
|
|
18
|
-
profile?: ReactNode;
|
|
15
|
+
logo: React.ReactNode;
|
|
16
|
+
search: React.ReactNode;
|
|
17
|
+
profile?: React.ReactNode;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
export function Navbar({ menu, logo, search, profile }: NavbarProps): JSX.Element | null {
|
|
22
21
|
const [isOpen, setIsOpen] = useMobileMenu(false);
|
|
23
|
-
const { search: searchSettings, navbar } =
|
|
22
|
+
const { search: searchSettings, navbar } = useDefaultThemeSettings();
|
|
24
23
|
const hideSearch =
|
|
25
24
|
searchSettings?.hide || (searchSettings?.placement && searchSettings?.placement !== 'navbar');
|
|
26
25
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
|
|
3
4
|
import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
6
|
+
import { useSidebarSiblingsData } from '@portal/hooks';
|
|
7
7
|
import { Button } from '@theme/Button/Button';
|
|
8
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
8
9
|
|
|
9
10
|
interface NextPageType {
|
|
10
11
|
nextPage?: ResolvedNavItemWithLink | null;
|
|
@@ -12,7 +13,7 @@ interface NextPageType {
|
|
|
12
13
|
|
|
13
14
|
export function NextPageLink(): JSX.Element {
|
|
14
15
|
const { nextPage }: NextPageType = useSidebarSiblingsData() || {};
|
|
15
|
-
const { navigation } =
|
|
16
|
+
const { navigation } = useDefaultThemeSettings();
|
|
16
17
|
|
|
17
18
|
if (!nextPage || navigation?.hide || navigation?.nextPageLink?.hide) {
|
|
18
19
|
return <div> </div>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
|
|
3
4
|
import { PreviousPageLink } from '@theme/PageNavigation/PreviousPageLink';
|
|
4
5
|
import { NextPageLink } from '@theme/PageNavigation/NextPageLink';
|
|
5
|
-
import {
|
|
6
|
-
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
6
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
7
7
|
|
|
8
8
|
type PageNavigationProps = {
|
|
9
9
|
showPrevButton?: boolean;
|
|
@@ -14,7 +14,7 @@ export function PageNavigation({
|
|
|
14
14
|
showPrevButton = true,
|
|
15
15
|
showNextButton = true,
|
|
16
16
|
}: PageNavigationProps): JSX.Element | null {
|
|
17
|
-
const { navigation } =
|
|
17
|
+
const { navigation } = useDefaultThemeSettings();
|
|
18
18
|
|
|
19
19
|
if (navigation?.hide) {
|
|
20
20
|
return null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
|
|
3
4
|
import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { useSidebarSiblingsData } from '@portal/hooks';
|
|
7
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
7
8
|
import { Button } from '@theme/Button/Button';
|
|
8
9
|
|
|
9
10
|
interface PreviousPageType {
|
|
@@ -12,7 +13,7 @@ interface PreviousPageType {
|
|
|
12
13
|
|
|
13
14
|
export function PreviousPageLink(): JSX.Element {
|
|
14
15
|
const { prevPage }: PreviousPageType = useSidebarSiblingsData() || {};
|
|
15
|
-
const { navigation } =
|
|
16
|
+
const { navigation } = useDefaultThemeSettings();
|
|
16
17
|
|
|
17
18
|
if (!prevPage || navigation?.hide || navigation?.previousPageLink?.hide) {
|
|
18
19
|
return <div> </div>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseSyntheticEvent, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { PanelHeaderProps } from '@theme/Panel/PanelHeader';
|
|
@@ -15,7 +15,7 @@ export interface PanelComponentProps {
|
|
|
15
15
|
renderChildrenHidden?: boolean;
|
|
16
16
|
header?: ReactNode | ((props: PanelHeaderProps) => ReactNode);
|
|
17
17
|
onToggle?: (expanded: boolean) => void;
|
|
18
|
-
description?: ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function PanelComponent({
|
package/src/Profile/Profile.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChangeEvent, KeyboardEvent, ReactNode, SyntheticEvent } from 'react';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
package/src/Search/ClearIcon.tsx
CHANGED
package/src/Search/Search.tsx
CHANGED
package/src/Search/utils.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import { ArrowBack } from '@theme/Sidebar/ArrowBack';
|
|
5
5
|
|
|
@@ -7,7 +7,10 @@ interface BackButtonProps {
|
|
|
7
7
|
back: () => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function BackButton({
|
|
10
|
+
export function BackButton({
|
|
11
|
+
children,
|
|
12
|
+
back,
|
|
13
|
+
}: React.PropsWithChildren<BackButtonProps>): JSX.Element {
|
|
11
14
|
return (
|
|
12
15
|
<Button onClick={back} data-component-name="Sidebar/BackButton">
|
|
13
16
|
<ArrowBack />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
5
5
|
|
|
@@ -18,7 +18,7 @@ export function Drilldown({
|
|
|
18
18
|
item,
|
|
19
19
|
expand,
|
|
20
20
|
...props
|
|
21
|
-
}: PropsWithChildren<DrilldownProps>): JSX.Element {
|
|
21
|
+
}: React.PropsWithChildren<DrilldownProps>): JSX.Element {
|
|
22
22
|
return (
|
|
23
23
|
<Wrapper data-component-name="Sidebar/Drilldown">
|
|
24
24
|
<DrilldownLabel onClick={expand}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled, { keyframes } from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { DrilldownMenuProps } from '@theme/Sidebar/types/DrilldownMenuProps';
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ export function DrilldownMenu({
|
|
|
11
11
|
back,
|
|
12
12
|
prevActiveItem,
|
|
13
13
|
children,
|
|
14
|
-
}: PropsWithChildren<DrilldownMenuProps>): JSX.Element {
|
|
14
|
+
}: React.PropsWithChildren<DrilldownMenuProps>): JSX.Element {
|
|
15
15
|
return (
|
|
16
16
|
<MenuContainer data-component-name="Sidebar/DrilldownMenu">
|
|
17
17
|
<MenuContent>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ItemState } from '@theme/Sidebar/types/ItemState';
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ export function MenuGroup({
|
|
|
19
19
|
isExpanded,
|
|
20
20
|
toggleExpanded,
|
|
21
21
|
children,
|
|
22
|
-
}: PropsWithChildren<MenuGroupProps>): JSX.Element {
|
|
22
|
+
}: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
|
|
23
23
|
return (
|
|
24
24
|
<Wrapper data-component-name="Sidebar/MenuGroup">
|
|
25
25
|
<MenuLinkItem item={item}>
|
package/src/Sidebar/MenuItem.tsx
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { MenuItemProps } from '@theme/Sidebar/types/MenuItemProps';
|
|
5
5
|
|
|
6
6
|
import { MenuLink } from '@theme/Sidebar/MenuLink';
|
|
7
7
|
|
|
8
|
-
export function MenuLinkItem({
|
|
8
|
+
export function MenuLinkItem({
|
|
9
|
+
item,
|
|
10
|
+
children,
|
|
11
|
+
}: React.PropsWithChildren<MenuItemProps>): JSX.Element {
|
|
9
12
|
return (
|
|
10
13
|
<Wrapper data-component-name="Sidebar/MenuLinkItem">
|
|
11
14
|
{item.link ? (
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Sidebar } from '@theme/Sidebar/Sidebar';
|
|
5
5
|
import { useMobileMenu } from '@theme/hooks/useMobileMenu';
|
|
6
6
|
import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
|
|
7
7
|
import { MenuContainer } from '@theme/Sidebar/MenuContainer';
|
|
8
|
-
import { useThemeSettings } from '@portal/hooks';
|
|
9
|
-
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
10
8
|
import { SidebarSearch } from '@theme/Search/SidebarSearch';
|
|
9
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
11
10
|
|
|
12
11
|
interface SidebarLayoutProps {
|
|
13
|
-
versions: ReactNode;
|
|
14
|
-
menu: ReactNode;
|
|
12
|
+
versions: React.ReactNode;
|
|
13
|
+
menu: React.ReactNode;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null {
|
|
18
17
|
const [isOpen, setIsOpen] = useMobileMenu();
|
|
19
18
|
const toggleMenu = () => setIsOpen(!isOpen);
|
|
20
|
-
const { search, sidebar } =
|
|
19
|
+
const { search, sidebar } = useDefaultThemeSettings();
|
|
21
20
|
|
|
22
21
|
if (sidebar?.hide) {
|
|
23
22
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { MdHeading } from '@theme/types/portal';
|
|
@@ -6,9 +6,8 @@ import type { MdHeading } from '@theme/types/portal';
|
|
|
6
6
|
import { getDisplayedHeadingsIds, getDisplayedHeadings, getLeastDepth } from './utils';
|
|
7
7
|
|
|
8
8
|
import { useFullHeight } from '@theme/hooks/useFullHeight';
|
|
9
|
-
import { useThemeSettings } from '@portal/hooks';
|
|
10
9
|
import { useActiveHeading } from '@theme/hooks/useActiveHeading';
|
|
11
|
-
import {
|
|
10
|
+
import { useDefaultThemeSettings } from '@theme/hooks/useDefaultThemeSettings';
|
|
12
11
|
|
|
13
12
|
interface TableOfContentProps {
|
|
14
13
|
headings?: Array<MdHeading | null> | null | undefined;
|
|
@@ -21,7 +20,7 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
21
20
|
|
|
22
21
|
const sidebar = useRef<HTMLDivElement | null>(null);
|
|
23
22
|
useFullHeight(sidebar);
|
|
24
|
-
const { toc } =
|
|
23
|
+
const { toc } = useDefaultThemeSettings();
|
|
25
24
|
|
|
26
25
|
const displayedHeadings = getDisplayedHeadings(headings, tocMaxDepth);
|
|
27
26
|
const leastDepth = getLeastDepth(displayedHeadings);
|
package/src/Tooltip/Tooltip.tsx
CHANGED