@docusaurus/theme-classic 2.0.0-beta.17 → 2.0.0-beta.18
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/getSwizzleConfig.js +113 -2
- package/lib/index.js +7 -12
- package/lib/theme-classic.d.ts +286 -60
- package/lib/translations.js +12 -2
- package/lib/validateThemeConfig.js +1 -1
- package/lib-next/theme/BackToTopButton/index.js +1 -3
- package/lib-next/theme/BlogArchivePage/index.js +14 -10
- package/lib-next/theme/BlogListPage/index.js +34 -13
- package/lib-next/theme/BlogPostItem/index.js +6 -6
- package/lib-next/theme/BlogPostPage/index.js +56 -45
- package/lib-next/theme/BlogTagsListPage/index.js +16 -12
- package/lib-next/theme/BlogTagsPostsPage/index.js +40 -33
- package/lib-next/theme/CodeBlock/CopyButton/index.js +60 -0
- package/lib-next/theme/CodeBlock/CopyButton/styles.module.css +66 -0
- package/lib-next/theme/CodeBlock/index.js +4 -36
- package/lib-next/theme/CodeBlock/styles.module.css +2 -22
- package/lib-next/theme/ColorModeToggle/index.js +36 -57
- package/lib-next/theme/ColorModeToggle/styles.module.css +8 -24
- package/lib-next/theme/DocBreadcrumbs/index.js +28 -11
- package/lib-next/theme/DocBreadcrumbs/styles.module.css +2 -17
- package/lib-next/theme/DocCard/index.js +17 -15
- package/lib-next/theme/DocCard/styles.module.css +8 -17
- package/lib-next/theme/DocCardList/index.js +15 -3
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +27 -6
- package/lib-next/theme/DocItem/index.js +84 -66
- package/lib-next/theme/DocPage/index.js +88 -89
- package/lib-next/theme/DocPage/styles.module.css +0 -4
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/lib-next/theme/DocSidebar/Mobile/index.js +49 -0
- package/lib-next/theme/DocSidebar/index.js +6 -113
- package/lib-next/theme/DocSidebarItem/index.js +14 -13
- package/lib-next/theme/DocSidebarItem/styles.module.css +4 -0
- package/lib-next/theme/DocTagDocListPage/index.js +38 -31
- package/lib-next/theme/DocTagsListPage/index.js +21 -16
- package/lib-next/theme/Footer/Copyright/index.js +18 -0
- package/lib-next/theme/Footer/Layout/index.js +26 -0
- package/lib-next/theme/Footer/LinkItem/index.js +33 -0
- package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
- package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
- package/lib-next/theme/Footer/Links/index.js +17 -0
- package/lib-next/theme/Footer/Logo/index.js +38 -0
- package/lib-next/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
- package/lib-next/theme/Footer/index.js +11 -163
- package/lib-next/theme/Heading/index.js +6 -4
- package/lib-next/theme/IconExternalLink/styles.module.css +0 -2
- package/lib-next/theme/Layout/index.js +15 -10
- package/lib-next/theme/LayoutProviders/index.js +5 -4
- package/lib-next/theme/MDXComponents/A.js +11 -0
- package/lib-next/theme/MDXComponents/Code.js +28 -0
- package/lib-next/theme/MDXComponents/Details.js +20 -0
- package/lib-next/theme/MDXComponents/Head.js +26 -0
- package/lib-next/theme/MDXComponents/Heading.js +11 -0
- package/lib-next/theme/MDXComponents/Img.js +24 -0
- package/lib-next/theme/MDXComponents/Img.module.css +10 -0
- package/lib-next/theme/MDXComponents/Pre.js +18 -0
- package/lib-next/theme/MDXComponents/Ul.js +23 -0
- package/{src/theme/MDXComponents/styles.css → lib-next/theme/MDXComponents/Ul.module.css} +1 -5
- package/lib-next/theme/MDXComponents/index.js +22 -71
- package/lib-next/theme/MDXContent/index.js +12 -0
- package/lib-next/theme/MDXPage/index.js +33 -28
- package/lib-next/theme/Navbar/ColorModeToggle/index.js +25 -0
- package/lib-next/theme/Navbar/Content/index.js +70 -0
- package/lib-next/theme/Navbar/Content/styles.module.css +15 -0
- package/lib-next/theme/Navbar/Layout/index.js +54 -0
- package/{src/theme/Navbar → lib-next/theme/Navbar/Layout}/styles.module.css +0 -13
- package/lib-next/theme/Navbar/Logo/index.js +17 -0
- package/lib-next/theme/Navbar/MobileSidebar/Header/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/Layout/index.js +28 -0
- package/lib-next/theme/Navbar/MobileSidebar/PrimaryMenu/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/SecondaryMenu/index.js +36 -0
- package/lib-next/theme/Navbar/MobileSidebar/Toggle/index.js +23 -0
- package/lib-next/theme/Navbar/MobileSidebar/index.js +31 -0
- package/lib-next/theme/Navbar/index.js +6 -271
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +2 -6
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +10 -2
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +8 -12
- package/lib-next/theme/NotFound.js +38 -33
- package/lib-next/theme/{LayoutHead → SiteMetadata}/index.js +11 -26
- package/lib-next/theme/TOCCollapsible/index.js +1 -3
- package/lib-next/theme/Tabs/__tests__/index.test.js +5 -5
- package/lib-next/theme/Tabs/index.js +2 -2
- package/lib-next/theme/Tag/index.js +4 -4
- package/lib-next/theme/ThemedImage/index.js +3 -3
- package/package.json +17 -17
- package/src/getSwizzleConfig.ts +122 -1
- package/src/index.ts +10 -12
- package/src/theme/BackToTopButton/index.tsx +1 -3
- package/src/theme/BlogArchivePage/index.tsx +18 -17
- package/src/theme/BlogLayout/index.tsx +1 -1
- package/src/theme/BlogListPage/index.tsx +32 -13
- package/src/theme/BlogPostItem/index.tsx +6 -6
- package/src/theme/BlogPostPage/index.tsx +55 -48
- package/src/theme/BlogTagsListPage/index.tsx +16 -12
- package/src/theme/BlogTagsPostsPage/index.tsx +39 -32
- package/src/theme/CodeBlock/CopyButton/index.tsx +66 -0
- package/src/theme/CodeBlock/CopyButton/styles.module.css +66 -0
- package/src/theme/CodeBlock/index.tsx +6 -38
- package/src/theme/CodeBlock/styles.module.css +2 -22
- package/src/theme/ColorModeToggle/index.tsx +36 -61
- package/src/theme/ColorModeToggle/styles.module.css +8 -24
- package/src/theme/DocBreadcrumbs/index.tsx +29 -10
- package/src/theme/DocBreadcrumbs/styles.module.css +2 -17
- package/src/theme/DocCard/index.tsx +24 -17
- package/src/theme/DocCard/styles.module.css +8 -17
- package/src/theme/DocCardList/index.tsx +14 -3
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +31 -4
- package/src/theme/DocItem/index.tsx +71 -55
- package/src/theme/DocPage/index.tsx +89 -90
- package/src/theme/DocPage/styles.module.css +0 -4
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
- package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/src/theme/DocSidebar/Mobile/index.tsx +54 -0
- package/src/theme/DocSidebar/index.tsx +6 -121
- package/src/theme/DocSidebarItem/index.tsx +15 -16
- package/src/theme/DocSidebarItem/styles.module.css +4 -0
- package/src/theme/DocTagDocListPage/index.tsx +38 -30
- package/src/theme/DocTagsListPage/index.tsx +21 -16
- package/src/theme/DocVersionBanner/index.tsx +3 -4
- package/src/theme/Footer/Copyright/index.tsx +20 -0
- package/src/theme/Footer/Layout/index.tsx +34 -0
- package/src/theme/Footer/LinkItem/index.tsx +36 -0
- package/src/theme/Footer/Links/MultiColumn/index.tsx +51 -0
- package/src/theme/Footer/Links/Simple/index.tsx +42 -0
- package/src/theme/Footer/Links/index.tsx +21 -0
- package/src/theme/Footer/Logo/index.tsx +41 -0
- package/src/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
- package/src/theme/Footer/index.tsx +12 -186
- package/src/theme/Heading/index.tsx +6 -4
- package/src/theme/IconExternalLink/styles.module.css +0 -2
- package/src/theme/Layout/index.tsx +15 -10
- package/src/theme/LayoutProviders/index.tsx +5 -4
- package/src/theme/MDXComponents/A.tsx +14 -0
- package/src/theme/MDXComponents/Code.tsx +37 -0
- package/src/theme/MDXComponents/Details.tsx +26 -0
- package/src/theme/MDXComponents/Head.tsx +29 -0
- package/src/theme/MDXComponents/Heading.tsx +14 -0
- package/src/theme/MDXComponents/Img.module.css +10 -0
- package/src/theme/MDXComponents/Img.tsx +26 -0
- package/src/theme/MDXComponents/Pre.tsx +22 -0
- package/{lib-next/theme/MDXComponents/styles.css → src/theme/MDXComponents/Ul.module.css} +1 -5
- package/src/theme/MDXComponents/Ul.tsx +28 -0
- package/src/theme/MDXComponents/index.tsx +23 -80
- package/src/theme/MDXContent/index.tsx +15 -0
- package/src/theme/MDXPage/index.tsx +33 -28
- package/src/theme/Navbar/ColorModeToggle/index.tsx +30 -0
- package/src/theme/Navbar/Content/index.tsx +81 -0
- package/src/theme/Navbar/Content/styles.module.css +15 -0
- package/src/theme/Navbar/Layout/index.tsx +57 -0
- package/{lib-next/theme/Navbar → src/theme/Navbar/Layout}/styles.module.css +0 -13
- package/src/theme/Navbar/Logo/index.tsx +19 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +34 -0
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +31 -0
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +25 -0
- package/src/theme/Navbar/MobileSidebar/index.tsx +33 -0
- package/src/theme/Navbar/index.tsx +6 -286
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +11 -2
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +1 -1
- package/src/theme/NavbarItem/NavbarNavLink.tsx +3 -7
- package/src/theme/NavbarItem/index.tsx +3 -4
- package/src/theme/NotFound.tsx +38 -33
- package/src/theme/{LayoutHead → SiteMetadata}/index.tsx +11 -25
- package/src/theme/TOCCollapsible/index.tsx +1 -3
- package/src/theme/Tabs/index.tsx +5 -6
- package/src/theme/Tag/index.tsx +4 -4
- package/src/theme/ThemedImage/index.tsx +4 -3
- package/src/theme-classic.d.ts +286 -60
- package/src/translations.ts +12 -6
- package/src/validateThemeConfig.ts +6 -6
- package/lib-next/theme/DocSidebar/styles.module.css +0 -107
- package/lib-next/theme/Seo/index.js +0 -40
- package/src/theme/DocSidebar/styles.module.css +0 -107
- package/src/theme/Seo/index.tsx +0 -49
|
@@ -143,7 +143,8 @@ function DocSidebarItemCategory({
|
|
|
143
143
|
})}>
|
|
144
144
|
<Link
|
|
145
145
|
className={clsx('menu__link', {
|
|
146
|
-
'menu__link--sublist': collapsible
|
|
146
|
+
'menu__link--sublist': collapsible,
|
|
147
|
+
'menu__link--sublist-caret': !href,
|
|
147
148
|
'menu__link--active': isActive,
|
|
148
149
|
})}
|
|
149
150
|
onClick={
|
|
@@ -163,6 +164,7 @@ function DocSidebarItemCategory({
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
167
|
+
aria-expanded={collapsible ? !collapsed : undefined}
|
|
166
168
|
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
167
169
|
{...props}>
|
|
168
170
|
{label}
|
|
@@ -231,6 +233,7 @@ function DocSidebarItemLink({
|
|
|
231
233
|
}) {
|
|
232
234
|
const {href, label, className} = item;
|
|
233
235
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
236
|
+
const isInternalLink = isInternalUrl(href);
|
|
234
237
|
return (
|
|
235
238
|
<li
|
|
236
239
|
className={clsx(
|
|
@@ -241,23 +244,21 @@ function DocSidebarItemLink({
|
|
|
241
244
|
)}
|
|
242
245
|
key={label}>
|
|
243
246
|
<Link
|
|
244
|
-
className={clsx(
|
|
245
|
-
'menu__link
|
|
246
|
-
|
|
247
|
+
className={clsx(
|
|
248
|
+
'menu__link',
|
|
249
|
+
!isInternalLink && styles.menuExternalLink,
|
|
250
|
+
{
|
|
251
|
+
'menu__link--active': isActive,
|
|
252
|
+
},
|
|
253
|
+
)}
|
|
247
254
|
aria-current={isActive ? 'page' : undefined}
|
|
248
255
|
to={href}
|
|
249
|
-
{...(
|
|
256
|
+
{...(isInternalLink && {
|
|
250
257
|
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
251
258
|
})}
|
|
252
259
|
{...props}>
|
|
253
|
-
{
|
|
254
|
-
|
|
255
|
-
) : (
|
|
256
|
-
<span>
|
|
257
|
-
{label}
|
|
258
|
-
<IconExternalLink />
|
|
259
|
-
</span>
|
|
260
|
-
)}
|
|
260
|
+
{label}
|
|
261
|
+
{!isInternalLink && <IconExternalLink />}
|
|
261
262
|
</Link>
|
|
262
263
|
</li>
|
|
263
264
|
);
|
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Layout from '@theme/Layout';
|
|
9
9
|
import Link from '@docusaurus/Link';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
PageMetadata,
|
|
12
|
+
HtmlClassNameProvider,
|
|
13
|
+
ThemeClassNames,
|
|
14
|
+
usePluralForm,
|
|
15
|
+
} from '@docusaurus/theme-common';
|
|
11
16
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
17
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
18
|
+
import clsx from 'clsx'; // Very simple pluralization: probably good enough for now
|
|
12
19
|
|
|
13
|
-
// Very simple pluralization: probably good enough for now
|
|
14
20
|
function useNDocsTaggedPlural() {
|
|
15
21
|
const {selectMessage} = usePluralForm();
|
|
16
22
|
return (count) =>
|
|
@@ -55,35 +61,36 @@ export default function DocTagDocListPage({tag}) {
|
|
|
55
61
|
},
|
|
56
62
|
);
|
|
57
63
|
return (
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
<HtmlClassNameProvider
|
|
65
|
+
className={clsx(
|
|
66
|
+
ThemeClassNames.wrapper.docsPages,
|
|
67
|
+
ThemeClassNames.page.docsTagDocListPage,
|
|
68
|
+
)}>
|
|
69
|
+
<PageMetadata title={title} />
|
|
70
|
+
<SearchMetadata tag="doc_tag_doc_list" />
|
|
71
|
+
<Layout>
|
|
72
|
+
<div className="container margin-vert--lg">
|
|
73
|
+
<div className="row">
|
|
74
|
+
<main className="col col--8 col--offset-2">
|
|
75
|
+
<header className="margin-bottom--xl">
|
|
76
|
+
<h1>{title}</h1>
|
|
77
|
+
<Link href={tag.allTagsPath}>
|
|
78
|
+
<Translate
|
|
79
|
+
id="theme.tags.tagsPageLink"
|
|
80
|
+
description="The label of the link targeting the tag list page">
|
|
81
|
+
View All Tags
|
|
82
|
+
</Translate>
|
|
83
|
+
</Link>
|
|
84
|
+
</header>
|
|
85
|
+
<section className="margin-vert--lg">
|
|
86
|
+
{tag.docs.map((doc) => (
|
|
87
|
+
<DocItem key={doc.id} doc={doc} />
|
|
88
|
+
))}
|
|
89
|
+
</section>
|
|
90
|
+
</main>
|
|
91
|
+
</div>
|
|
85
92
|
</div>
|
|
86
|
-
</
|
|
87
|
-
</
|
|
93
|
+
</Layout>
|
|
94
|
+
</HtmlClassNameProvider>
|
|
88
95
|
);
|
|
89
96
|
}
|
|
@@ -7,29 +7,34 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Layout from '@theme/Layout';
|
|
9
9
|
import {
|
|
10
|
+
PageMetadata,
|
|
11
|
+
HtmlClassNameProvider,
|
|
10
12
|
ThemeClassNames,
|
|
11
13
|
translateTagsPageTitle,
|
|
12
14
|
} from '@docusaurus/theme-common';
|
|
13
15
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
16
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
17
|
+
import clsx from 'clsx';
|
|
14
18
|
export default function DocTagsListPage({tags}) {
|
|
15
19
|
const title = translateTagsPageTitle();
|
|
16
20
|
return (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
<HtmlClassNameProvider
|
|
22
|
+
className={clsx(
|
|
23
|
+
ThemeClassNames.wrapper.docsPages,
|
|
24
|
+
ThemeClassNames.page.docsTagsListPage,
|
|
25
|
+
)}>
|
|
26
|
+
<PageMetadata title={title} />
|
|
27
|
+
<SearchMetadata tag="doc_tags_list" />
|
|
28
|
+
<Layout>
|
|
29
|
+
<div className="container margin-vert--lg">
|
|
30
|
+
<div className="row">
|
|
31
|
+
<main className="col col--8 col--offset-2">
|
|
32
|
+
<h1>{title}</h1>
|
|
33
|
+
<TagsListByLetter tags={tags} />
|
|
34
|
+
</main>
|
|
35
|
+
</div>
|
|
31
36
|
</div>
|
|
32
|
-
</
|
|
33
|
-
</
|
|
37
|
+
</Layout>
|
|
38
|
+
</HtmlClassNameProvider>
|
|
34
39
|
);
|
|
35
40
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export default function FooterCopyright({copyright}) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
className="footer__copyright" // Developer provided the HTML, so assume it's safe.
|
|
12
|
+
// eslint-disable-next-line react/no-danger
|
|
13
|
+
dangerouslySetInnerHTML={{
|
|
14
|
+
__html: copyright,
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 clsx from 'clsx';
|
|
9
|
+
export default function FooterLayout({style, links, logo, copyright}) {
|
|
10
|
+
return (
|
|
11
|
+
<footer
|
|
12
|
+
className={clsx('footer', {
|
|
13
|
+
'footer--dark': style === 'dark',
|
|
14
|
+
})}>
|
|
15
|
+
<div className="container container-fluid">
|
|
16
|
+
{links}
|
|
17
|
+
{(logo || copyright) && (
|
|
18
|
+
<div className="footer__bottom text--center">
|
|
19
|
+
{logo && <div className="margin-bottom--sm">{logo}</div>}
|
|
20
|
+
{copyright}
|
|
21
|
+
</div>
|
|
22
|
+
)}
|
|
23
|
+
</div>
|
|
24
|
+
</footer>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -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
|
+
import React from 'react';
|
|
8
|
+
import Link from '@docusaurus/Link';
|
|
9
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
10
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
11
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
12
|
+
export default function FooterLinkItem({item}) {
|
|
13
|
+
const {to, href, label, prependBaseUrlToHref, ...props} = item;
|
|
14
|
+
const toUrl = useBaseUrl(to);
|
|
15
|
+
const normalizedHref = useBaseUrl(href, {
|
|
16
|
+
forcePrependBaseUrl: true,
|
|
17
|
+
});
|
|
18
|
+
return (
|
|
19
|
+
<Link
|
|
20
|
+
className="footer__link-item"
|
|
21
|
+
{...(href
|
|
22
|
+
? {
|
|
23
|
+
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
24
|
+
}
|
|
25
|
+
: {
|
|
26
|
+
to: toUrl,
|
|
27
|
+
})}
|
|
28
|
+
{...props}>
|
|
29
|
+
{label}
|
|
30
|
+
{href && !isInternalUrl(href) && <IconExternalLink />}
|
|
31
|
+
</Link>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 LinkItem from '@theme/Footer/LinkItem';
|
|
9
|
+
|
|
10
|
+
function ColumnLinkItem({item}) {
|
|
11
|
+
return item.html ? (
|
|
12
|
+
<li
|
|
13
|
+
className="footer__item" // Developer provided the HTML, so assume it's safe.
|
|
14
|
+
// eslint-disable-next-line react/no-danger
|
|
15
|
+
dangerouslySetInnerHTML={{
|
|
16
|
+
__html: item.html,
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
) : (
|
|
20
|
+
<li key={item.href || item.to} className="footer__item">
|
|
21
|
+
<LinkItem item={item} />
|
|
22
|
+
</li>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function Column({column}) {
|
|
27
|
+
return (
|
|
28
|
+
<div className="col footer__col">
|
|
29
|
+
<div className="footer__title">{column.title}</div>
|
|
30
|
+
<ul className="footer__items">
|
|
31
|
+
{column.items.map((item, i) => (
|
|
32
|
+
<ColumnLinkItem key={i} item={item} />
|
|
33
|
+
))}
|
|
34
|
+
</ul>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default function FooterLinksMultiColumn({columns}) {
|
|
40
|
+
return (
|
|
41
|
+
<div className="row footer__links">
|
|
42
|
+
{columns.map((column, i) => (
|
|
43
|
+
<Column key={i} column={column} />
|
|
44
|
+
))}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 LinkItem from '@theme/Footer/LinkItem';
|
|
9
|
+
|
|
10
|
+
function Separator() {
|
|
11
|
+
return <span className="footer__link-separator">·</span>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function SimpleLinkItem({item}) {
|
|
15
|
+
return item.html ? (
|
|
16
|
+
<span
|
|
17
|
+
className="footer__link-item" // Developer provided the HTML, so assume it's safe.
|
|
18
|
+
// eslint-disable-next-line react/no-danger
|
|
19
|
+
dangerouslySetInnerHTML={{
|
|
20
|
+
__html: item.html,
|
|
21
|
+
}}
|
|
22
|
+
/>
|
|
23
|
+
) : (
|
|
24
|
+
<LinkItem item={item} />
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function FooterLinksSimple({links}) {
|
|
29
|
+
return (
|
|
30
|
+
<div className="footer__links text--center">
|
|
31
|
+
<div className="footer__links">
|
|
32
|
+
{links.map((item, i) => (
|
|
33
|
+
<React.Fragment key={i}>
|
|
34
|
+
<SimpleLinkItem item={item} />
|
|
35
|
+
{links.length !== i + 1 && <Separator />}
|
|
36
|
+
</React.Fragment>
|
|
37
|
+
))}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 {isMultiColumnFooterLinks} from '@docusaurus/theme-common';
|
|
9
|
+
import FooterLinksMultiColumn from '@theme/Footer/Links/MultiColumn';
|
|
10
|
+
import FooterLinksSimple from '@theme/Footer/Links/Simple';
|
|
11
|
+
export default function FooterLinks({links}) {
|
|
12
|
+
return isMultiColumnFooterLinks(links) ? (
|
|
13
|
+
<FooterLinksMultiColumn columns={links} />
|
|
14
|
+
) : (
|
|
15
|
+
<FooterLinksSimple links={links} />
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 Link from '@docusaurus/Link';
|
|
9
|
+
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
import ThemedImage from '@theme/ThemedImage';
|
|
12
|
+
|
|
13
|
+
function LogoImage({logo}) {
|
|
14
|
+
const {withBaseUrl} = useBaseUrlUtils();
|
|
15
|
+
const sources = {
|
|
16
|
+
light: withBaseUrl(logo.src),
|
|
17
|
+
dark: withBaseUrl(logo.srcDark ?? logo.src),
|
|
18
|
+
};
|
|
19
|
+
return (
|
|
20
|
+
<ThemedImage
|
|
21
|
+
className="footer__logo"
|
|
22
|
+
alt={logo.alt}
|
|
23
|
+
sources={sources}
|
|
24
|
+
width={logo.width}
|
|
25
|
+
height={logo.height}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function FooterLogo({logo}) {
|
|
31
|
+
return logo.href ? (
|
|
32
|
+
<Link href={logo.href} className={styles.footerLogoLink}>
|
|
33
|
+
<LogoImage logo={logo} />
|
|
34
|
+
</Link>
|
|
35
|
+
) : (
|
|
36
|
+
<LogoImage logo={logo} />
|
|
37
|
+
);
|
|
38
|
+
}
|
|
File without changes
|
|
@@ -5,179 +5,27 @@
|
|
|
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';
|
|
9
|
-
import Link from '@docusaurus/Link';
|
|
10
8
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import IconExternalLink from '@theme/IconExternalLink';
|
|
16
|
-
|
|
17
|
-
function FooterLink({to, href, label, prependBaseUrlToHref, ...props}) {
|
|
18
|
-
const toUrl = useBaseUrl(to);
|
|
19
|
-
const normalizedHref = useBaseUrl(href, {
|
|
20
|
-
forcePrependBaseUrl: true,
|
|
21
|
-
});
|
|
22
|
-
return (
|
|
23
|
-
<Link
|
|
24
|
-
className="footer__link-item"
|
|
25
|
-
{...(href
|
|
26
|
-
? {
|
|
27
|
-
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
28
|
-
}
|
|
29
|
-
: {
|
|
30
|
-
to: toUrl,
|
|
31
|
-
})}
|
|
32
|
-
{...props}>
|
|
33
|
-
{href && !isInternalUrl(href) ? (
|
|
34
|
-
<span>
|
|
35
|
-
{label}
|
|
36
|
-
<IconExternalLink />
|
|
37
|
-
</span>
|
|
38
|
-
) : (
|
|
39
|
-
label
|
|
40
|
-
)}
|
|
41
|
-
</Link>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function FooterLogo({sources, alt, width, height}) {
|
|
46
|
-
return (
|
|
47
|
-
<ThemedImage
|
|
48
|
-
className="footer__logo"
|
|
49
|
-
alt={alt}
|
|
50
|
-
sources={sources}
|
|
51
|
-
width={width}
|
|
52
|
-
height={height}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function MultiColumnLinks({links}) {
|
|
58
|
-
return (
|
|
59
|
-
<>
|
|
60
|
-
{links.map((linkItem, i) => (
|
|
61
|
-
<div key={i} className="col footer__col">
|
|
62
|
-
<div className="footer__title">{linkItem.title}</div>
|
|
63
|
-
<ul className="footer__items">
|
|
64
|
-
{linkItem.items.map((item, key) =>
|
|
65
|
-
item.html ? (
|
|
66
|
-
<li
|
|
67
|
-
key={key}
|
|
68
|
-
className="footer__item" // Developer provided the HTML, so assume it's safe.
|
|
69
|
-
// eslint-disable-next-line react/no-danger
|
|
70
|
-
dangerouslySetInnerHTML={{
|
|
71
|
-
__html: item.html,
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
) : (
|
|
75
|
-
<li key={item.href || item.to} className="footer__item">
|
|
76
|
-
<FooterLink {...item} />
|
|
77
|
-
</li>
|
|
78
|
-
),
|
|
79
|
-
)}
|
|
80
|
-
</ul>
|
|
81
|
-
</div>
|
|
82
|
-
))}
|
|
83
|
-
</>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function SimpleLinks({links}) {
|
|
88
|
-
return (
|
|
89
|
-
<div className="footer__links">
|
|
90
|
-
{links.map((item, key) => (
|
|
91
|
-
<React.Fragment key={key}>
|
|
92
|
-
{item.html ? (
|
|
93
|
-
<span
|
|
94
|
-
className="footer__link-item" // Developer provided the HTML, so assume it's safe.
|
|
95
|
-
// eslint-disable-next-line react/no-danger
|
|
96
|
-
dangerouslySetInnerHTML={{
|
|
97
|
-
__html: item.html,
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
) : (
|
|
101
|
-
<FooterLink {...item} />
|
|
102
|
-
)}
|
|
103
|
-
{links.length !== key + 1 && (
|
|
104
|
-
<span className="footer__link-separator">·</span>
|
|
105
|
-
)}
|
|
106
|
-
</React.Fragment>
|
|
107
|
-
))}
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function isMultiColumnFooterLinks(links) {
|
|
113
|
-
return 'title' in links[0];
|
|
114
|
-
}
|
|
9
|
+
import FooterLinks from '@theme/Footer/Links';
|
|
10
|
+
import FooterLogo from '@theme/Footer/Logo';
|
|
11
|
+
import FooterCopyright from '@theme/Footer/Copyright';
|
|
12
|
+
import FooterLayout from '@theme/Footer/Layout';
|
|
115
13
|
|
|
116
14
|
function Footer() {
|
|
117
15
|
const {footer} = useThemeConfig();
|
|
118
|
-
const {copyright, links = [], logo = {}} = footer || {};
|
|
119
|
-
const sources = {
|
|
120
|
-
light: useBaseUrl(logo.src),
|
|
121
|
-
dark: useBaseUrl(logo.srcDark || logo.src),
|
|
122
|
-
};
|
|
123
16
|
|
|
124
17
|
if (!footer) {
|
|
125
18
|
return null;
|
|
126
19
|
}
|
|
127
20
|
|
|
21
|
+
const {copyright, links, logo, style} = footer;
|
|
128
22
|
return (
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
links.length > 0 &&
|
|
136
|
-
(isMultiColumnFooterLinks(links) ? (
|
|
137
|
-
<div className="row footer__links">
|
|
138
|
-
<MultiColumnLinks links={links} />
|
|
139
|
-
</div>
|
|
140
|
-
) : (
|
|
141
|
-
<div className="footer__links text--center">
|
|
142
|
-
<SimpleLinks links={links} />
|
|
143
|
-
</div>
|
|
144
|
-
))}
|
|
145
|
-
{(logo || copyright) && (
|
|
146
|
-
<div className="footer__bottom text--center">
|
|
147
|
-
{logo && (logo.src || logo.srcDark) && (
|
|
148
|
-
<div className="margin-bottom--sm">
|
|
149
|
-
{logo.href ? (
|
|
150
|
-
<Link href={logo.href} className={styles.footerLogoLink}>
|
|
151
|
-
<FooterLogo
|
|
152
|
-
alt={logo.alt}
|
|
153
|
-
sources={sources}
|
|
154
|
-
width={logo.width}
|
|
155
|
-
height={logo.height}
|
|
156
|
-
/>
|
|
157
|
-
</Link>
|
|
158
|
-
) : (
|
|
159
|
-
<FooterLogo
|
|
160
|
-
alt={logo.alt}
|
|
161
|
-
sources={sources}
|
|
162
|
-
width={logo.width}
|
|
163
|
-
height={logo.height}
|
|
164
|
-
/>
|
|
165
|
-
)}
|
|
166
|
-
</div>
|
|
167
|
-
)}
|
|
168
|
-
{copyright ? (
|
|
169
|
-
<div
|
|
170
|
-
className="footer__copyright" // Developer provided the HTML, so assume it's safe.
|
|
171
|
-
// eslint-disable-next-line react/no-danger
|
|
172
|
-
dangerouslySetInnerHTML={{
|
|
173
|
-
__html: copyright,
|
|
174
|
-
}}
|
|
175
|
-
/>
|
|
176
|
-
) : null}
|
|
177
|
-
</div>
|
|
178
|
-
)}
|
|
179
|
-
</div>
|
|
180
|
-
</footer>
|
|
23
|
+
<FooterLayout
|
|
24
|
+
style={style}
|
|
25
|
+
links={links && links.length > 0 && <FooterLinks links={links} />}
|
|
26
|
+
logo={logo && <FooterLogo logo={logo} />}
|
|
27
|
+
copyright={copyright && <FooterCopyright copyright={copyright} />}
|
|
28
|
+
/>
|
|
181
29
|
);
|
|
182
30
|
}
|
|
183
31
|
|
|
@@ -22,10 +22,12 @@ function AnchorHeading({as: As, id, ...props}) {
|
|
|
22
22
|
return (
|
|
23
23
|
<As
|
|
24
24
|
{...props}
|
|
25
|
-
className={clsx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
className={clsx(
|
|
26
|
+
'anchor',
|
|
27
|
+
hideOnScroll
|
|
28
|
+
? styles.anchorWithHideOnScrollNavbar
|
|
29
|
+
: styles.anchorWithStickyNavbar,
|
|
30
|
+
)}
|
|
29
31
|
id={id}>
|
|
30
32
|
{props.children}
|
|
31
33
|
<a
|