@docusaurus/theme-classic 2.0.0-beta.18 → 2.0.0-beta.19
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/lib/admonitions.css +4 -0
- package/lib/default.css +3038 -0
- package/lib/getSwizzleConfig.js +9 -2
- package/lib/index.js +4 -4
- package/lib/nprogress.css +41 -0
- package/lib/nprogress.js +46 -0
- package/lib/theme-classic.d.ts +315 -33
- package/lib/validateThemeConfig.js +72 -14
- package/lib-next/theme/BackToTopButton/index.js +6 -102
- package/lib-next/theme/BlogLayout/index.js +1 -5
- package/lib-next/theme/BlogListPaginator/index.js +25 -28
- package/lib-next/theme/BlogPostAuthor/index.js +3 -6
- package/lib-next/theme/BlogPostItem/styles.module.css +9 -0
- package/lib-next/theme/BlogPostPaginator/index.js +25 -28
- package/lib-next/theme/BlogSidebar/Desktop/index.js +41 -0
- package/lib-next/theme/BlogSidebar/{styles.module.css → Desktop/styles.module.css} +1 -2
- package/lib-next/theme/BlogSidebar/Mobile/index.js +36 -0
- package/lib-next/theme/BlogSidebar/index.js +11 -31
- package/lib-next/theme/BlogTagsListPage/index.js +2 -3
- package/lib-next/theme/BlogTagsPostsPage/index.js +4 -6
- package/lib-next/theme/CodeBlock/Container/index.js +29 -0
- package/lib-next/theme/CodeBlock/Container/styles.module.css +14 -0
- package/lib-next/theme/CodeBlock/Content/Element.js +23 -0
- package/lib-next/theme/CodeBlock/Content/String.js +104 -0
- package/{src/theme/CodeBlock → lib-next/theme/CodeBlock/Content}/styles.module.css +39 -9
- package/lib-next/theme/CodeBlock/CopyButton/index.js +3 -2
- package/lib-next/theme/CodeBlock/CopyButton/styles.module.css +0 -19
- package/lib-next/theme/CodeBlock/Line/index.js +49 -0
- package/lib-next/theme/CodeBlock/Line/styles.module.css +51 -0
- package/lib-next/theme/CodeBlock/WordWrapButton/index.js +40 -0
- package/lib-next/theme/CodeBlock/WordWrapButton/styles.module.css +15 -0
- package/lib-next/theme/CodeBlock/index.js +27 -133
- package/lib-next/theme/Details/index.js +1 -1
- package/lib-next/theme/DocBreadcrumbs/index.js +50 -23
- package/lib-next/theme/DocBreadcrumbs/styles.module.css +8 -0
- package/lib-next/theme/DocCardList/index.js +6 -4
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +3 -3
- package/lib-next/theme/DocCategoryGeneratedIndexPage/styles.module.css +8 -0
- package/lib-next/theme/DocItem/index.js +1 -1
- package/lib-next/theme/DocItem/styles.module.css +6 -0
- package/lib-next/theme/DocPage/Layout/Main/index.js +29 -0
- package/lib-next/theme/DocPage/Layout/Main/styles.module.css +28 -0
- package/lib-next/theme/DocPage/Layout/Sidebar/ExpandButton/index.js +34 -0
- package/lib-next/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +33 -0
- package/lib-next/theme/DocPage/Layout/Sidebar/index.js +68 -0
- package/lib-next/theme/DocPage/Layout/Sidebar/index.module.css +32 -0
- package/lib-next/theme/DocPage/Layout/index.js +34 -0
- package/lib-next/theme/{BlogPostAuthor/styles.module.css → DocPage/Layout/index.module.css} +6 -3
- package/lib-next/theme/DocPage/index.js +28 -146
- package/lib-next/theme/DocPaginator/index.js +25 -28
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +11 -9
- package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +6 -0
- package/lib-next/theme/DocSidebar/Desktop/index.js +4 -2
- package/lib-next/theme/DocSidebarItem/Category.js +197 -0
- package/lib-next/theme/DocSidebarItem/Html.js +27 -0
- package/{src/theme/DocSidebarItem/styles.module.css → lib-next/theme/DocSidebarItem/Html.module.css} +0 -4
- package/lib-next/theme/DocSidebarItem/Link.js +53 -0
- package/{src/theme/MDXComponents/Ul.module.css → lib-next/theme/DocSidebarItem/Link.module.css} +2 -3
- package/lib-next/theme/DocSidebarItem/index.js +4 -246
- package/lib-next/theme/DocSidebarItems/index.js +1 -6
- package/lib-next/theme/DocTagDocListPage/index.js +3 -3
- package/lib-next/theme/DocVersionBanner/index.js +2 -2
- package/lib-next/theme/Footer/Links/MultiColumn/index.js +1 -1
- package/lib-next/theme/Heading/index.js +4 -20
- package/lib-next/theme/IconHome/index.js +17 -0
- package/lib-next/theme/LastUpdated/index.js +1 -0
- package/lib-next/theme/Layout/index.js +1 -1
- package/lib-next/theme/MDXComponents/Ul.js +2 -4
- package/lib-next/theme/Navbar/Content/index.js +6 -1
- package/lib-next/theme/Navbar/Logo/index.js +1 -1
- package/lib-next/theme/Navbar/Search/index.js +11 -0
- package/lib-next/theme/Navbar/Search/styles.module.css +20 -0
- package/lib-next/theme/NavbarItem/ComponentTypes.js +27 -0
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +11 -28
- package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +10 -42
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +25 -29
- package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +2 -9
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +4 -1
- package/lib-next/theme/NavbarItem/HtmlNavbarItem.js +30 -0
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +5 -10
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +49 -31
- package/lib-next/theme/NavbarItem/SearchNavbarItem.js +6 -1
- package/lib-next/theme/NavbarItem/index.js +4 -23
- package/lib-next/theme/NavbarItem/utils.js +2 -1
- package/lib-next/theme/PaginatorNavLink/index.js +8 -2
- package/lib-next/theme/SiteMetadata/index.js +8 -7
- package/lib-next/theme/SkipToContent/index.js +3 -29
- package/lib-next/theme/TOCCollapsible/CollapseButton.js +29 -0
- package/{src/theme/TOCCollapsible/styles.module.css → lib-next/theme/TOCCollapsible/CollapseButton.module.css} +1 -22
- package/lib-next/theme/TOCCollapsible/index.js +3 -13
- package/lib-next/theme/TOCCollapsible/index.module.css +31 -0
- package/lib-next/theme/TOCItems/Tree.js +40 -0
- package/lib-next/theme/TOCItems/index.js +3 -34
- package/lib-next/theme/TabItem/index.js +3 -1
- package/lib-next/theme/{MDXComponents/Ul.module.css → TabItem/styles.module.css} +2 -3
- package/lib-next/theme/Tabs/__tests__/index.test.js +3 -3
- package/lib-next/theme/Tabs/index.js +3 -3
- package/lib-next/theme/Tabs/styles.module.css +4 -0
- package/lib-next/theme/Tag/index.js +2 -3
- package/lib-next/theme/TagsListInline/index.js +1 -1
- package/package.json +23 -18
- package/src/admonitions.css +4 -0
- package/src/getSwizzleConfig.ts +10 -2
- package/src/index.ts +4 -3
- package/src/nprogress.css +41 -0
- package/src/nprogress.ts +31 -0
- package/src/theme/BackToTopButton/index.tsx +5 -112
- package/src/theme/BlogLayout/index.tsx +1 -5
- package/src/theme/BlogListPaginator/index.tsx +25 -28
- package/src/theme/BlogPostAuthor/index.tsx +3 -7
- package/src/theme/BlogPostItem/styles.module.css +9 -0
- package/src/theme/BlogPostPaginator/index.tsx +25 -28
- package/src/theme/BlogSidebar/Desktop/index.tsx +45 -0
- package/src/theme/BlogSidebar/{styles.module.css → Desktop/styles.module.css} +1 -2
- package/src/theme/BlogSidebar/Mobile/index.tsx +38 -0
- package/src/theme/BlogSidebar/index.tsx +10 -31
- package/src/theme/BlogTagsListPage/index.tsx +2 -3
- package/src/theme/BlogTagsPostsPage/index.tsx +8 -5
- package/src/theme/CodeBlock/Container/index.tsx +35 -0
- package/src/theme/CodeBlock/Container/styles.module.css +14 -0
- package/src/theme/CodeBlock/Content/Element.tsx +30 -0
- package/src/theme/CodeBlock/Content/String.tsx +111 -0
- package/{lib-next/theme/CodeBlock → src/theme/CodeBlock/Content}/styles.module.css +39 -9
- package/src/theme/CodeBlock/CopyButton/index.tsx +3 -2
- package/src/theme/CodeBlock/CopyButton/styles.module.css +0 -19
- package/src/theme/CodeBlock/Line/index.tsx +48 -0
- package/src/theme/CodeBlock/Line/styles.module.css +51 -0
- package/src/theme/CodeBlock/WordWrapButton/index.tsx +49 -0
- package/src/theme/CodeBlock/WordWrapButton/styles.module.css +15 -0
- package/src/theme/CodeBlock/index.tsx +29 -133
- package/src/theme/Details/index.tsx +1 -1
- package/src/theme/DocBreadcrumbs/index.tsx +50 -20
- package/src/theme/DocBreadcrumbs/styles.module.css +8 -0
- package/src/theme/DocCardList/index.tsx +5 -7
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +3 -3
- package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +8 -0
- package/src/theme/DocItem/index.tsx +1 -1
- package/src/theme/DocItem/styles.module.css +6 -0
- package/src/theme/DocPage/Layout/Main/index.tsx +37 -0
- package/src/theme/DocPage/Layout/Main/styles.module.css +28 -0
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx +40 -0
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +33 -0
- package/src/theme/DocPage/Layout/Sidebar/index.module.css +32 -0
- package/src/theme/DocPage/Layout/Sidebar/index.tsx +74 -0
- package/src/theme/{BlogPostAuthor/styles.module.css → DocPage/Layout/index.module.css} +6 -3
- package/src/theme/DocPage/Layout/index.tsx +39 -0
- package/src/theme/DocPage/index.tsx +28 -157
- package/src/theme/DocPaginator/index.tsx +25 -28
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +11 -9
- package/src/theme/DocSidebar/Desktop/Content/styles.module.css +6 -0
- package/src/theme/DocSidebar/Desktop/index.tsx +4 -2
- package/src/theme/DocSidebarItem/Category.tsx +210 -0
- package/{lib-next/theme/DocSidebarItem/styles.module.css → src/theme/DocSidebarItem/Html.module.css} +0 -4
- package/src/theme/DocSidebarItem/Html.tsx +34 -0
- package/src/theme/DocSidebarItem/Link.module.css +10 -0
- package/src/theme/DocSidebarItem/Link.tsx +58 -0
- package/src/theme/DocSidebarItem/index.tsx +4 -259
- package/src/theme/DocSidebarItems/index.tsx +1 -6
- package/src/theme/DocTagDocListPage/index.tsx +3 -4
- package/src/theme/DocVersionBanner/index.tsx +2 -2
- package/src/theme/Footer/Links/MultiColumn/index.tsx +1 -1
- package/src/theme/Heading/index.tsx +4 -18
- package/src/theme/IconHome/index.tsx +20 -0
- package/src/theme/LastUpdated/index.tsx +1 -0
- package/src/theme/Layout/index.tsx +1 -1
- package/src/theme/MDXComponents/Details.tsx +2 -3
- package/src/theme/MDXComponents/Ul.tsx +2 -6
- package/src/theme/Navbar/Content/index.tsx +6 -1
- package/src/theme/Navbar/Logo/index.tsx +1 -1
- package/src/theme/Navbar/Search/index.tsx +15 -0
- package/src/theme/Navbar/Search/styles.module.css +20 -0
- package/src/theme/NavbarItem/ComponentTypes.tsx +32 -0
- package/src/theme/NavbarItem/DocNavbarItem.tsx +13 -32
- package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +9 -49
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +26 -33
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +3 -10
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +4 -1
- package/src/theme/NavbarItem/HtmlNavbarItem.tsx +32 -0
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +5 -9
- package/src/theme/NavbarItem/NavbarNavLink.tsx +41 -25
- package/src/theme/NavbarItem/SearchNavbarItem.tsx +6 -1
- package/src/theme/NavbarItem/index.tsx +9 -38
- package/src/theme/NavbarItem/utils.ts +5 -2
- package/src/theme/PaginatorNavLink/index.tsx +8 -2
- package/src/theme/SiteMetadata/index.tsx +8 -8
- package/src/theme/SkipToContent/index.tsx +3 -29
- package/{lib-next/theme/TOCCollapsible/styles.module.css → src/theme/TOCCollapsible/CollapseButton.module.css} +1 -22
- package/src/theme/TOCCollapsible/CollapseButton.tsx +35 -0
- package/src/theme/TOCCollapsible/index.module.css +31 -0
- package/src/theme/TOCCollapsible/index.tsx +3 -14
- package/src/theme/TOCItems/Tree.tsx +46 -0
- package/src/theme/TOCItems/index.tsx +2 -41
- package/src/theme/TabItem/index.tsx +7 -1
- package/src/theme/TabItem/styles.module.css +10 -0
- package/src/theme/Tabs/index.tsx +3 -3
- package/src/theme/Tabs/styles.module.css +4 -0
- package/src/theme/Tag/index.tsx +2 -4
- package/src/theme/TagsListInline/index.tsx +1 -1
- package/src/theme-classic.d.ts +315 -33
- package/src/validateThemeConfig.ts +80 -13
- package/lib/types.d.ts +0 -11
- package/lib-next/theme/DocPage/styles.module.css +0 -82
- package/src/theme/DocPage/styles.module.css +0 -82
- package/src/types.d.ts +0 -11
|
@@ -13,27 +13,42 @@ import {
|
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
import clsx from 'clsx';
|
|
15
15
|
import Link from '@docusaurus/Link';
|
|
16
|
-
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
16
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
17
|
+
import {translate} from '@docusaurus/Translate';
|
|
18
|
+
import IconHome from '@theme/IconHome'; // TODO move to design system folder
|
|
17
19
|
|
|
18
|
-
function BreadcrumbsItemLink({children, href}) {
|
|
20
|
+
function BreadcrumbsItemLink({children, href, isLast}) {
|
|
19
21
|
const className = 'breadcrumbs__link';
|
|
22
|
+
|
|
23
|
+
if (isLast) {
|
|
24
|
+
return (
|
|
25
|
+
<span className={className} itemProp="name">
|
|
26
|
+
{children}
|
|
27
|
+
</span>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
return href ? (
|
|
21
32
|
<Link className={className} href={href} itemProp="item">
|
|
22
33
|
<span itemProp="name">{children}</span>
|
|
23
|
-
</Link>
|
|
34
|
+
</Link> // TODO Google search console doesn't like breadcrumb items without href.
|
|
24
35
|
) : (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
36
|
+
// The schema doesn't seem to require `id` for each `item`, although Google
|
|
37
|
+
// insist to infer one, even if it's invalid. Removing `itemProp="item
|
|
38
|
+
// name"` for now, since I don't know how to properly fix it.
|
|
39
|
+
// See https://github.com/facebook/docusaurus/issues/7241
|
|
40
|
+
<span className={className}>{children}</span>
|
|
28
41
|
);
|
|
29
42
|
} // TODO move to design system folder
|
|
30
43
|
|
|
31
|
-
function BreadcrumbsItem({children, active, index}) {
|
|
44
|
+
function BreadcrumbsItem({children, active, index, addMicrodata}) {
|
|
32
45
|
return (
|
|
33
46
|
<li
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
{...(addMicrodata && {
|
|
48
|
+
itemScope: true,
|
|
49
|
+
itemProp: 'itemListElement',
|
|
50
|
+
itemType: 'https://schema.org/ListItem',
|
|
51
|
+
})}
|
|
37
52
|
className={clsx('breadcrumbs__item', {
|
|
38
53
|
'breadcrumbs__item--active': active,
|
|
39
54
|
})}>
|
|
@@ -48,9 +63,14 @@ function HomeBreadcrumbItem() {
|
|
|
48
63
|
return (
|
|
49
64
|
<li className="breadcrumbs__item">
|
|
50
65
|
<Link
|
|
66
|
+
aria-label={translate({
|
|
67
|
+
id: 'theme.docs.breadcrumbs.home',
|
|
68
|
+
message: 'Home page',
|
|
69
|
+
description: 'The ARIA label for the home page in the breadcrumbs',
|
|
70
|
+
})}
|
|
51
71
|
className={clsx('breadcrumbs__link', styles.breadcrumbsItemLink)}
|
|
52
72
|
href={homeHref}>
|
|
53
|
-
|
|
73
|
+
<IconHome className={styles.breadcrumbHomeIcon} />
|
|
54
74
|
</Link>
|
|
55
75
|
</li>
|
|
56
76
|
);
|
|
@@ -70,23 +90,30 @@ export default function DocBreadcrumbs() {
|
|
|
70
90
|
ThemeClassNames.docs.docBreadcrumbs,
|
|
71
91
|
styles.breadcrumbsContainer,
|
|
72
92
|
)}
|
|
73
|
-
aria-label=
|
|
93
|
+
aria-label={translate({
|
|
94
|
+
id: 'theme.docs.breadcrumbs.navAriaLabel',
|
|
95
|
+
message: 'Breadcrumbs',
|
|
96
|
+
description: 'The ARIA label for the breadcrumbs',
|
|
97
|
+
})}>
|
|
74
98
|
<ul
|
|
75
99
|
className="breadcrumbs"
|
|
76
100
|
itemScope
|
|
77
101
|
itemType="https://schema.org/BreadcrumbList">
|
|
78
102
|
{homePageRoute && <HomeBreadcrumbItem />}
|
|
79
|
-
{breadcrumbs.map((item, idx) =>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{item.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
{breadcrumbs.map((item, idx) => {
|
|
104
|
+
const isLast = idx === breadcrumbs.length - 1;
|
|
105
|
+
return (
|
|
106
|
+
<BreadcrumbsItem
|
|
107
|
+
key={idx}
|
|
108
|
+
active={isLast}
|
|
109
|
+
index={idx}
|
|
110
|
+
addMicrodata={!!item.href}>
|
|
111
|
+
<BreadcrumbsItemLink href={item.href} isLast={isLast}>
|
|
112
|
+
{item.label}
|
|
113
|
+
</BreadcrumbsItemLink>
|
|
114
|
+
</BreadcrumbsItem>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
90
117
|
</ul>
|
|
91
118
|
</nav>
|
|
92
119
|
);
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import DocCard from '@theme/DocCard';
|
|
9
|
-
import {findFirstCategoryLink} from '@docusaurus/theme-common';
|
|
10
|
+
import {findFirstCategoryLink} from '@docusaurus/theme-common';
|
|
10
11
|
|
|
12
|
+
// Filter categories that don't have a link.
|
|
11
13
|
function filterItems(items) {
|
|
12
14
|
return items.filter((item) => {
|
|
13
15
|
if (item.type === 'category') {
|
|
@@ -18,14 +20,14 @@ function filterItems(items) {
|
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
export default function DocCardList({items}) {
|
|
23
|
+
export default function DocCardList({items, className}) {
|
|
22
24
|
return (
|
|
23
|
-
<
|
|
25
|
+
<section className={clsx('row', className)}>
|
|
24
26
|
{filterItems(items).map((item, index) => (
|
|
25
27
|
<article key={index} className="col col--6 margin-bottom--lg">
|
|
26
28
|
<DocCard key={index} item={item} />
|
|
27
29
|
</article>
|
|
28
30
|
))}
|
|
29
|
-
</
|
|
31
|
+
</section>
|
|
30
32
|
);
|
|
31
33
|
}
|
|
@@ -51,9 +51,9 @@ function DocCategoryGeneratedIndexPageContent({categoryGeneratedIndex}) {
|
|
|
51
51
|
<p>{categoryGeneratedIndex.description}</p>
|
|
52
52
|
)}
|
|
53
53
|
</header>
|
|
54
|
-
<
|
|
55
|
-
<DocCardList items={category.items} />
|
|
56
|
-
</
|
|
54
|
+
<article className="margin-top--lg">
|
|
55
|
+
<DocCardList items={category.items} className={styles.list} />
|
|
56
|
+
</article>
|
|
57
57
|
<footer className="margin-top--lg">
|
|
58
58
|
<DocPaginator
|
|
59
59
|
previous={categoryGeneratedIndex.navigation.previous}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
.generatedIndexPage {
|
|
10
10
|
max-width: 75% !important;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
.list article:nth-last-child(-n + 2) {
|
|
14
|
+
margin-bottom: 0 !important;
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
/* Duplicated from .markdown h1 */
|
|
@@ -16,3 +20,7 @@
|
|
|
16
20
|
--ifm-h1-font-size: 3rem;
|
|
17
21
|
margin-bottom: calc(1.25 * var(--ifm-leading));
|
|
18
22
|
}
|
|
23
|
+
|
|
24
|
+
.list article:last-child {
|
|
25
|
+
margin-bottom: 0 !important;
|
|
26
|
+
}
|
|
@@ -51,7 +51,7 @@ function DocItemContent(props) {
|
|
|
51
51
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
52
52
|
} = frontMatter;
|
|
53
53
|
const {title} = metadata; // We only add a title if:
|
|
54
|
-
// - user
|
|
54
|
+
// - user doesn't ask to hide it with front matter
|
|
55
55
|
// - the markdown content does not already contain a top-level h1 heading
|
|
56
56
|
|
|
57
57
|
const shouldAddTitle =
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
export default function DocPageLayoutMain({hiddenSidebarContainer, children}) {
|
|
12
|
+
const sidebar = useDocsSidebar();
|
|
13
|
+
return (
|
|
14
|
+
<main
|
|
15
|
+
className={clsx(
|
|
16
|
+
styles.docMainContainer,
|
|
17
|
+
(hiddenSidebarContainer || !sidebar) && styles.docMainContainerEnhanced,
|
|
18
|
+
)}>
|
|
19
|
+
<div
|
|
20
|
+
className={clsx(
|
|
21
|
+
'container padding-top--md padding-bottom--lg',
|
|
22
|
+
styles.docItemWrapper,
|
|
23
|
+
hiddenSidebarContainer && styles.docItemWrapperEnhanced,
|
|
24
|
+
)}>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
</main>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.docMainContainer {
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docMainContainer {
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
max-width: calc(100% - var(--doc-sidebar-width));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.docMainContainerEnhanced {
|
|
20
|
+
max-width: calc(100% - var(--doc-sidebar-hidden-width));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.docItemWrapperEnhanced {
|
|
24
|
+
max-width: calc(
|
|
25
|
+
var(--ifm-container-width) + var(--doc-sidebar-width)
|
|
26
|
+
) !important;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import IconArrow from '@theme/IconArrow';
|
|
9
|
+
import {translate} from '@docusaurus/Translate';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
export default function DocPageLayoutSidebarExpandButton({toggleSidebar}) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className={styles.expandButton}
|
|
15
|
+
title={translate({
|
|
16
|
+
id: 'theme.docs.sidebar.expandButtonTitle',
|
|
17
|
+
message: 'Expand sidebar',
|
|
18
|
+
description:
|
|
19
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
20
|
+
})}
|
|
21
|
+
aria-label={translate({
|
|
22
|
+
id: 'theme.docs.sidebar.expandButtonAriaLabel',
|
|
23
|
+
message: 'Expand sidebar',
|
|
24
|
+
description:
|
|
25
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
26
|
+
})}
|
|
27
|
+
tabIndex={0}
|
|
28
|
+
role="button"
|
|
29
|
+
onKeyDown={toggleSidebar}
|
|
30
|
+
onClick={toggleSidebar}>
|
|
31
|
+
<IconArrow className={styles.expandButtonIcon} />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@media (min-width: 997px) {
|
|
9
|
+
.expandButton {
|
|
10
|
+
position: sticky;
|
|
11
|
+
top: 0;
|
|
12
|
+
height: 100%;
|
|
13
|
+
max-height: 100vh;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
transition: background-color var(--ifm-transition-fast) ease;
|
|
18
|
+
background-color: var(--docusaurus-collapse-button-bg);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.expandButton:hover,
|
|
22
|
+
.expandButton:focus {
|
|
23
|
+
background-color: var(--docusaurus-collapse-button-bg-hover);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.expandButtonIcon {
|
|
27
|
+
transform: rotate(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[dir='rtl'] .expandButtonIcon {
|
|
31
|
+
transform: rotate(180deg);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, {useState, useCallback} from 'react';
|
|
8
|
+
import DocSidebar from '@theme/DocSidebar';
|
|
9
|
+
import {useLocation} from '@docusaurus/router';
|
|
10
|
+
import ExpandButton from '@theme/DocPage/Layout/Sidebar/ExpandButton';
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
import styles from './index.module.css';
|
|
13
|
+
import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common'; // Reset sidebar state when sidebar changes
|
|
14
|
+
// Use React key to unmount/remount the children
|
|
15
|
+
// See https://github.com/facebook/docusaurus/issues/3414
|
|
16
|
+
|
|
17
|
+
function ResetOnSidebarChange({children}) {
|
|
18
|
+
const sidebar = useDocsSidebar();
|
|
19
|
+
return (
|
|
20
|
+
<React.Fragment key={sidebar?.name ?? 'noSidebar'}>
|
|
21
|
+
{children}
|
|
22
|
+
</React.Fragment>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function DocPageLayoutSidebar({
|
|
27
|
+
sidebar,
|
|
28
|
+
hiddenSidebarContainer,
|
|
29
|
+
setHiddenSidebarContainer,
|
|
30
|
+
}) {
|
|
31
|
+
const {pathname} = useLocation();
|
|
32
|
+
const [hiddenSidebar, setHiddenSidebar] = useState(false);
|
|
33
|
+
const toggleSidebar = useCallback(() => {
|
|
34
|
+
if (hiddenSidebar) {
|
|
35
|
+
setHiddenSidebar(false);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setHiddenSidebarContainer((value) => !value);
|
|
39
|
+
}, [setHiddenSidebarContainer, hiddenSidebar]);
|
|
40
|
+
return (
|
|
41
|
+
<aside
|
|
42
|
+
className={clsx(
|
|
43
|
+
ThemeClassNames.docs.docSidebarContainer,
|
|
44
|
+
styles.docSidebarContainer,
|
|
45
|
+
hiddenSidebarContainer && styles.docSidebarContainerHidden,
|
|
46
|
+
)}
|
|
47
|
+
onTransitionEnd={(e) => {
|
|
48
|
+
if (!e.currentTarget.classList.contains(styles.docSidebarContainer)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (hiddenSidebarContainer) {
|
|
53
|
+
setHiddenSidebar(true);
|
|
54
|
+
}
|
|
55
|
+
}}>
|
|
56
|
+
<ResetOnSidebarChange>
|
|
57
|
+
<DocSidebar
|
|
58
|
+
sidebar={sidebar}
|
|
59
|
+
path={pathname}
|
|
60
|
+
onCollapse={toggleSidebar}
|
|
61
|
+
isHidden={hiddenSidebar}
|
|
62
|
+
/>
|
|
63
|
+
</ResetOnSidebarChange>
|
|
64
|
+
|
|
65
|
+
{hiddenSidebar && <ExpandButton toggleSidebar={toggleSidebar} />}
|
|
66
|
+
</aside>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
--doc-sidebar-width: 300px;
|
|
10
|
+
--doc-sidebar-hidden-width: 30px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.docSidebarContainer {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@media (min-width: 997px) {
|
|
18
|
+
.docSidebarContainer {
|
|
19
|
+
display: block;
|
|
20
|
+
width: var(--doc-sidebar-width);
|
|
21
|
+
margin-top: calc(-1 * var(--ifm-navbar-height));
|
|
22
|
+
border-right: 1px solid var(--ifm-toc-border-color);
|
|
23
|
+
will-change: width;
|
|
24
|
+
transition: width var(--ifm-transition-fast) ease;
|
|
25
|
+
clip-path: inset(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.docSidebarContainerHidden {
|
|
29
|
+
width: var(--doc-sidebar-hidden-width);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, {useState} from 'react';
|
|
8
|
+
import Layout from '@theme/Layout';
|
|
9
|
+
import BackToTopButton from '@theme/BackToTopButton';
|
|
10
|
+
import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar';
|
|
11
|
+
import DocPageLayoutMain from '@theme/DocPage/Layout/Main';
|
|
12
|
+
import styles from './index.module.css';
|
|
13
|
+
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
14
|
+
export default function DocPageLayout({children}) {
|
|
15
|
+
const sidebar = useDocsSidebar();
|
|
16
|
+
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
|
17
|
+
return (
|
|
18
|
+
<Layout wrapperClassName={styles.docsWrapper}>
|
|
19
|
+
<BackToTopButton />
|
|
20
|
+
<div className={styles.docPage}>
|
|
21
|
+
{sidebar && (
|
|
22
|
+
<DocPageLayoutSidebar
|
|
23
|
+
sidebar={sidebar.items}
|
|
24
|
+
hiddenSidebarContainer={hiddenSidebarContainer}
|
|
25
|
+
setHiddenSidebarContainer={setHiddenSidebarContainer}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
28
|
+
<DocPageLayoutMain hiddenSidebarContainer={hiddenSidebarContainer}>
|
|
29
|
+
{children}
|
|
30
|
+
</DocPageLayoutMain>
|
|
31
|
+
</div>
|
|
32
|
+
</Layout>
|
|
33
|
+
);
|
|
34
|
+
}
|