@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
|
@@ -160,7 +160,8 @@ function DocSidebarItemCategory({
|
|
|
160
160
|
})}>
|
|
161
161
|
<Link
|
|
162
162
|
className={clsx('menu__link', {
|
|
163
|
-
'menu__link--sublist': collapsible
|
|
163
|
+
'menu__link--sublist': collapsible,
|
|
164
|
+
'menu__link--sublist-caret': !href,
|
|
164
165
|
'menu__link--active': isActive,
|
|
165
166
|
})}
|
|
166
167
|
onClick={
|
|
@@ -179,6 +180,7 @@ function DocSidebarItemCategory({
|
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
183
|
+
aria-expanded={collapsible ? !collapsed : undefined}
|
|
182
184
|
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
183
185
|
{...props}>
|
|
184
186
|
{label}
|
|
@@ -233,9 +235,7 @@ function DocSidebarItemHtml({
|
|
|
233
235
|
)}
|
|
234
236
|
key={index}
|
|
235
237
|
// eslint-disable-next-line react/no-danger
|
|
236
|
-
dangerouslySetInnerHTML={{
|
|
237
|
-
__html: value,
|
|
238
|
-
}}
|
|
238
|
+
dangerouslySetInnerHTML={{__html: value}}
|
|
239
239
|
/>
|
|
240
240
|
);
|
|
241
241
|
}
|
|
@@ -250,6 +250,7 @@ function DocSidebarItemLink({
|
|
|
250
250
|
}: Props & {item: PropSidebarItemLink}) {
|
|
251
251
|
const {href, label, className} = item;
|
|
252
252
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
253
|
+
const isInternalLink = isInternalUrl(href);
|
|
253
254
|
return (
|
|
254
255
|
<li
|
|
255
256
|
className={clsx(
|
|
@@ -260,23 +261,21 @@ function DocSidebarItemLink({
|
|
|
260
261
|
)}
|
|
261
262
|
key={label}>
|
|
262
263
|
<Link
|
|
263
|
-
className={clsx(
|
|
264
|
-
'menu__link
|
|
265
|
-
|
|
264
|
+
className={clsx(
|
|
265
|
+
'menu__link',
|
|
266
|
+
!isInternalLink && styles.menuExternalLink,
|
|
267
|
+
{
|
|
268
|
+
'menu__link--active': isActive,
|
|
269
|
+
},
|
|
270
|
+
)}
|
|
266
271
|
aria-current={isActive ? 'page' : undefined}
|
|
267
272
|
to={href}
|
|
268
|
-
{...(
|
|
273
|
+
{...(isInternalLink && {
|
|
269
274
|
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
270
275
|
})}
|
|
271
276
|
{...props}>
|
|
272
|
-
{
|
|
273
|
-
|
|
274
|
-
) : (
|
|
275
|
-
<span>
|
|
276
|
-
{label}
|
|
277
|
-
<IconExternalLink />
|
|
278
|
-
</span>
|
|
279
|
-
)}
|
|
277
|
+
{label}
|
|
278
|
+
{!isInternalLink && <IconExternalLink />}
|
|
280
279
|
</Link>
|
|
281
280
|
</li>
|
|
282
281
|
);
|
|
@@ -9,10 +9,17 @@ import React from 'react';
|
|
|
9
9
|
|
|
10
10
|
import Layout from '@theme/Layout';
|
|
11
11
|
import Link from '@docusaurus/Link';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
PageMetadata,
|
|
14
|
+
HtmlClassNameProvider,
|
|
15
|
+
ThemeClassNames,
|
|
16
|
+
usePluralForm,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
13
18
|
import type {PropTagDocListDoc} from '@docusaurus/plugin-content-docs';
|
|
14
19
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
15
20
|
import type {Props} from '@theme/DocTagDocListPage';
|
|
21
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
22
|
+
import clsx from 'clsx';
|
|
16
23
|
|
|
17
24
|
// Very simple pluralization: probably good enough for now
|
|
18
25
|
function useNDocsTaggedPlural() {
|
|
@@ -55,35 +62,36 @@ export default function DocTagDocListPage({tag}: Props): JSX.Element {
|
|
|
55
62
|
);
|
|
56
63
|
|
|
57
64
|
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
|
-
|
|
65
|
+
<HtmlClassNameProvider
|
|
66
|
+
className={clsx(
|
|
67
|
+
ThemeClassNames.wrapper.docsPages,
|
|
68
|
+
ThemeClassNames.page.docsTagDocListPage,
|
|
69
|
+
)}>
|
|
70
|
+
<PageMetadata title={title} />
|
|
71
|
+
<SearchMetadata tag="doc_tag_doc_list" />
|
|
72
|
+
<Layout>
|
|
73
|
+
<div className="container margin-vert--lg">
|
|
74
|
+
<div className="row">
|
|
75
|
+
<main className="col col--8 col--offset-2">
|
|
76
|
+
<header className="margin-bottom--xl">
|
|
77
|
+
<h1>{title}</h1>
|
|
78
|
+
<Link href={tag.allTagsPath}>
|
|
79
|
+
<Translate
|
|
80
|
+
id="theme.tags.tagsPageLink"
|
|
81
|
+
description="The label of the link targeting the tag list page">
|
|
82
|
+
View All Tags
|
|
83
|
+
</Translate>
|
|
84
|
+
</Link>
|
|
85
|
+
</header>
|
|
86
|
+
<section className="margin-vert--lg">
|
|
87
|
+
{tag.docs.map((doc) => (
|
|
88
|
+
<DocItem key={doc.id} doc={doc} />
|
|
89
|
+
))}
|
|
90
|
+
</section>
|
|
91
|
+
</main>
|
|
92
|
+
</div>
|
|
85
93
|
</div>
|
|
86
|
-
</
|
|
87
|
-
</
|
|
94
|
+
</Layout>
|
|
95
|
+
</HtmlClassNameProvider>
|
|
88
96
|
);
|
|
89
97
|
}
|
|
@@ -9,31 +9,36 @@ import React from 'react';
|
|
|
9
9
|
|
|
10
10
|
import Layout from '@theme/Layout';
|
|
11
11
|
import {
|
|
12
|
+
PageMetadata,
|
|
13
|
+
HtmlClassNameProvider,
|
|
12
14
|
ThemeClassNames,
|
|
13
15
|
translateTagsPageTitle,
|
|
14
16
|
} from '@docusaurus/theme-common';
|
|
15
17
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
16
18
|
import type {Props} from '@theme/DocTagsListPage';
|
|
19
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
|
+
import clsx from 'clsx';
|
|
17
21
|
|
|
18
22
|
export default function DocTagsListPage({tags}: Props): JSX.Element {
|
|
19
23
|
const title = translateTagsPageTitle();
|
|
20
24
|
return (
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
<HtmlClassNameProvider
|
|
26
|
+
className={clsx(
|
|
27
|
+
ThemeClassNames.wrapper.docsPages,
|
|
28
|
+
ThemeClassNames.page.docsTagsListPage,
|
|
29
|
+
)}>
|
|
30
|
+
<PageMetadata title={title} />
|
|
31
|
+
<SearchMetadata tag="doc_tags_list" />
|
|
32
|
+
<Layout>
|
|
33
|
+
<div className="container margin-vert--lg">
|
|
34
|
+
<div className="row">
|
|
35
|
+
<main className="col col--8 col--offset-2">
|
|
36
|
+
<h1>{title}</h1>
|
|
37
|
+
<TagsListByLetter tags={tags} />
|
|
38
|
+
</main>
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
36
|
-
</
|
|
37
|
-
</
|
|
41
|
+
</Layout>
|
|
42
|
+
</HtmlClassNameProvider>
|
|
38
43
|
);
|
|
39
44
|
}
|
|
@@ -70,10 +70,9 @@ function UnmaintainedVersionLabel({
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const BannerLabelComponents:
|
|
74
|
-
VersionBanner
|
|
75
|
-
|
|
76
|
-
> = {
|
|
73
|
+
const BannerLabelComponents: {
|
|
74
|
+
[banner in VersionBanner]: ComponentType<BannerLabelComponentProps>;
|
|
75
|
+
} = {
|
|
77
76
|
unreleased: UnreleasedVersionLabel,
|
|
78
77
|
unmaintained: UnmaintainedVersionLabel,
|
|
79
78
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Footer/Copyright';
|
|
10
|
+
|
|
11
|
+
export default function FooterCopyright({copyright}: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className="footer__copyright"
|
|
15
|
+
// Developer provided the HTML, so assume it's safe.
|
|
16
|
+
// eslint-disable-next-line react/no-danger
|
|
17
|
+
dangerouslySetInnerHTML={{__html: copyright}}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -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
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import type {Props} from '@theme/Footer/Layout';
|
|
11
|
+
|
|
12
|
+
export default function FooterLayout({
|
|
13
|
+
style,
|
|
14
|
+
links,
|
|
15
|
+
logo,
|
|
16
|
+
copyright,
|
|
17
|
+
}: Props): JSX.Element {
|
|
18
|
+
return (
|
|
19
|
+
<footer
|
|
20
|
+
className={clsx('footer', {
|
|
21
|
+
'footer--dark': style === 'dark',
|
|
22
|
+
})}>
|
|
23
|
+
<div className="container container-fluid">
|
|
24
|
+
{links}
|
|
25
|
+
{(logo || copyright) && (
|
|
26
|
+
<div className="footer__bottom text--center">
|
|
27
|
+
{logo && <div className="margin-bottom--sm">{logo}</div>}
|
|
28
|
+
{copyright}
|
|
29
|
+
</div>
|
|
30
|
+
)}
|
|
31
|
+
</div>
|
|
32
|
+
</footer>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import Link from '@docusaurus/Link';
|
|
11
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
12
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
13
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
14
|
+
import type {Props} from '@theme/Footer/LinkItem';
|
|
15
|
+
|
|
16
|
+
export default function FooterLinkItem({item}: Props): JSX.Element {
|
|
17
|
+
const {to, href, label, prependBaseUrlToHref, ...props} = item;
|
|
18
|
+
const toUrl = useBaseUrl(to);
|
|
19
|
+
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Link
|
|
23
|
+
className="footer__link-item"
|
|
24
|
+
{...(href
|
|
25
|
+
? {
|
|
26
|
+
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
to: toUrl,
|
|
30
|
+
})}
|
|
31
|
+
{...props}>
|
|
32
|
+
{label}
|
|
33
|
+
{href && !isInternalUrl(href) && <IconExternalLink />}
|
|
34
|
+
</Link>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Footer/Links/MultiColumn';
|
|
10
|
+
import LinkItem from '@theme/Footer/LinkItem';
|
|
11
|
+
|
|
12
|
+
type ColumnType = Props['columns'][number];
|
|
13
|
+
type ColumnItemType = ColumnType['items'][number];
|
|
14
|
+
|
|
15
|
+
function ColumnLinkItem({item}: {item: ColumnItemType}) {
|
|
16
|
+
return item.html ? (
|
|
17
|
+
<li
|
|
18
|
+
className="footer__item"
|
|
19
|
+
// Developer provided the HTML, so assume it's safe.
|
|
20
|
+
// eslint-disable-next-line react/no-danger
|
|
21
|
+
dangerouslySetInnerHTML={{__html: item.html}}
|
|
22
|
+
/>
|
|
23
|
+
) : (
|
|
24
|
+
<li key={item.href || item.to} className="footer__item">
|
|
25
|
+
<LinkItem item={item} />
|
|
26
|
+
</li>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Column({column}: {column: ColumnType}) {
|
|
31
|
+
return (
|
|
32
|
+
<div className="col footer__col">
|
|
33
|
+
<div className="footer__title">{column.title}</div>
|
|
34
|
+
<ul className="footer__items">
|
|
35
|
+
{column.items.map((item, i) => (
|
|
36
|
+
<ColumnLinkItem key={i} item={item} />
|
|
37
|
+
))}
|
|
38
|
+
</ul>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default function FooterLinksMultiColumn({columns}: Props): JSX.Element {
|
|
44
|
+
return (
|
|
45
|
+
<div className="row footer__links">
|
|
46
|
+
{columns.map((column, i) => (
|
|
47
|
+
<Column key={i} column={column} />
|
|
48
|
+
))}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Footer/Links/Simple';
|
|
10
|
+
import LinkItem from '@theme/Footer/LinkItem';
|
|
11
|
+
|
|
12
|
+
function Separator() {
|
|
13
|
+
return <span className="footer__link-separator">·</span>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function SimpleLinkItem({item}: {item: Props['links'][number]}) {
|
|
17
|
+
return item.html ? (
|
|
18
|
+
<span
|
|
19
|
+
className="footer__link-item"
|
|
20
|
+
// Developer provided the HTML, so assume it's safe.
|
|
21
|
+
// eslint-disable-next-line react/no-danger
|
|
22
|
+
dangerouslySetInnerHTML={{__html: item.html}}
|
|
23
|
+
/>
|
|
24
|
+
) : (
|
|
25
|
+
<LinkItem item={item} />
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function FooterLinksSimple({links}: Props): JSX.Element {
|
|
30
|
+
return (
|
|
31
|
+
<div className="footer__links text--center">
|
|
32
|
+
<div className="footer__links">
|
|
33
|
+
{links.map((item, i) => (
|
|
34
|
+
<React.Fragment key={i}>
|
|
35
|
+
<SimpleLinkItem item={item} />
|
|
36
|
+
{links.length !== i + 1 && <Separator />}
|
|
37
|
+
</React.Fragment>
|
|
38
|
+
))}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import {isMultiColumnFooterLinks} from '@docusaurus/theme-common';
|
|
11
|
+
import type {Props} from '@theme/Footer/Links';
|
|
12
|
+
import FooterLinksMultiColumn from '@theme/Footer/Links/MultiColumn';
|
|
13
|
+
import FooterLinksSimple from '@theme/Footer/Links/Simple';
|
|
14
|
+
|
|
15
|
+
export default function FooterLinks({links}: Props): JSX.Element {
|
|
16
|
+
return isMultiColumnFooterLinks(links) ? (
|
|
17
|
+
<FooterLinksMultiColumn columns={links} />
|
|
18
|
+
) : (
|
|
19
|
+
<FooterLinksSimple links={links} />
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -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
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import Link from '@docusaurus/Link';
|
|
11
|
+
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
12
|
+
import styles from './styles.module.css';
|
|
13
|
+
import ThemedImage from '@theme/ThemedImage';
|
|
14
|
+
import type {Props} from '@theme/Footer/Logo';
|
|
15
|
+
|
|
16
|
+
function LogoImage({logo}: Props) {
|
|
17
|
+
const {withBaseUrl} = useBaseUrlUtils();
|
|
18
|
+
const sources = {
|
|
19
|
+
light: withBaseUrl(logo.src),
|
|
20
|
+
dark: withBaseUrl(logo.srcDark ?? logo.src),
|
|
21
|
+
};
|
|
22
|
+
return (
|
|
23
|
+
<ThemedImage
|
|
24
|
+
className="footer__logo"
|
|
25
|
+
alt={logo.alt}
|
|
26
|
+
sources={sources}
|
|
27
|
+
width={logo.width}
|
|
28
|
+
height={logo.height}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default function FooterLogo({logo}: Props): JSX.Element {
|
|
34
|
+
return logo.href ? (
|
|
35
|
+
<Link href={logo.href} className={styles.footerLogoLink}>
|
|
36
|
+
<LogoImage logo={logo} />
|
|
37
|
+
</Link>
|
|
38
|
+
) : (
|
|
39
|
+
<LogoImage logo={logo} />
|
|
40
|
+
);
|
|
41
|
+
}
|
|
File without changes
|