@docusaurus/theme-classic 0.0.0-5264 → 0.0.0-5268

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.
Files changed (47) hide show
  1. package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.d.ts +2 -2
  2. package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.js +1 -1
  3. package/lib/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
  4. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.d.ts +2 -2
  5. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.js +1 -1
  6. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
  7. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.d.ts +2 -2
  8. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.js +2 -2
  9. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
  10. package/lib/theme/{DocPage → DocRoot}/Layout/index.d.ts +2 -2
  11. package/lib/theme/{DocPage → DocRoot}/Layout/index.js +9 -10
  12. package/{src/theme/DocPage → lib/theme/DocRoot}/Layout/styles.module.css +1 -1
  13. package/lib/theme/{DocPage → DocRoot}/index.d.ts +2 -2
  14. package/lib/theme/DocRoot/index.js +31 -0
  15. package/lib/theme/DocTagDocListPage/index.d.ts +1 -1
  16. package/lib/theme/DocTagDocListPage/index.js +49 -38
  17. package/lib/theme/DocTagsListPage/index.d.ts +1 -1
  18. package/lib/theme/DocTagsListPage/index.js +25 -17
  19. package/lib/theme/DocVersionRoot/index.d.ts +10 -0
  20. package/lib/theme/DocVersionRoot/index.js +46 -0
  21. package/lib/theme/DocsRoot/index.d.ts +10 -0
  22. package/lib/theme/DocsRoot/index.js +18 -0
  23. package/lib/theme/NotFound/Content/index.d.ts +9 -0
  24. package/lib/theme/NotFound/Content/index.js +41 -0
  25. package/lib/theme/{NotFound.d.ts → NotFound/index.d.ts} +1 -1
  26. package/lib/theme/NotFound/index.js +25 -0
  27. package/package.json +14 -14
  28. package/src/theme/{DocPage → DocRoot}/Layout/Main/index.tsx +2 -2
  29. package/src/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
  30. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.tsx +2 -2
  31. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
  32. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/index.tsx +3 -3
  33. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
  34. package/src/theme/{DocPage → DocRoot}/Layout/index.tsx +10 -11
  35. package/{lib/theme/DocPage → src/theme/DocRoot}/Layout/styles.module.css +1 -1
  36. package/src/theme/DocRoot/index.tsx +34 -0
  37. package/src/theme/DocTagDocListPage/index.tsx +56 -38
  38. package/src/theme/DocTagsListPage/index.tsx +32 -17
  39. package/src/theme/DocVersionRoot/index.tsx +51 -0
  40. package/src/theme/DocsRoot/index.tsx +22 -0
  41. package/src/theme/NotFound/Content/index.tsx +44 -0
  42. package/src/theme/NotFound/index.tsx +27 -0
  43. package/src/theme-classic.d.ts +16 -8
  44. package/lib/theme/DocPage/index.js +0 -67
  45. package/lib/theme/NotFound.js +0 -52
  46. package/src/theme/DocPage/index.tsx +0 -71
  47. package/src/theme/NotFound.tsx +0 -54
@@ -7,32 +7,31 @@
7
7
 
8
8
  import React, {useState} from 'react';
9
9
  import {useDocsSidebar} from '@docusaurus/theme-common/internal';
10
- import Layout from '@theme/Layout';
11
10
  import BackToTopButton from '@theme/BackToTopButton';
12
- import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar';
13
- import DocPageLayoutMain from '@theme/DocPage/Layout/Main';
14
- import type {Props} from '@theme/DocPage/Layout';
11
+ import DocRootLayoutSidebar from '@theme/DocRoot/Layout/Sidebar';
12
+ import DocRootLayoutMain from '@theme/DocRoot/Layout/Main';
13
+ import type {Props} from '@theme/DocRoot/Layout';
15
14
 
16
15
  import styles from './styles.module.css';
17
16
 
18
- export default function DocPageLayout({children}: Props): JSX.Element {
17
+ export default function DocRootLayout({children}: Props): JSX.Element {
19
18
  const sidebar = useDocsSidebar();
20
19
  const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
21
20
  return (
22
- <Layout wrapperClassName={styles.docsWrapper}>
21
+ <div className={styles.docsWrapper}>
23
22
  <BackToTopButton />
24
- <div className={styles.docPage}>
23
+ <div className={styles.docRoot}>
25
24
  {sidebar && (
26
- <DocPageLayoutSidebar
25
+ <DocRootLayoutSidebar
27
26
  sidebar={sidebar.items}
28
27
  hiddenSidebarContainer={hiddenSidebarContainer}
29
28
  setHiddenSidebarContainer={setHiddenSidebarContainer}
30
29
  />
31
30
  )}
32
- <DocPageLayoutMain hiddenSidebarContainer={hiddenSidebarContainer}>
31
+ <DocRootLayoutMain hiddenSidebarContainer={hiddenSidebarContainer}>
33
32
  {children}
34
- </DocPageLayoutMain>
33
+ </DocRootLayoutMain>
35
34
  </div>
36
- </Layout>
35
+ </div>
37
36
  );
38
37
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- .docPage {
8
+ .docRoot {
9
9
  display: flex;
10
10
  width: 100%;
11
11
  }
@@ -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 {HtmlClassNameProvider, ThemeClassNames} from '@docusaurus/theme-common';
11
+ import {
12
+ DocsSidebarProvider,
13
+ useDocRootMetadata,
14
+ } from '@docusaurus/theme-common/internal';
15
+ import DocRootLayout from '@theme/DocRoot/Layout';
16
+ import NotFoundContent from '@theme/NotFound/Content';
17
+ import type {Props} from '@theme/DocRoot';
18
+
19
+ export default function DocRoot(props: Props): JSX.Element {
20
+ const currentDocRouteMetadata = useDocRootMetadata(props);
21
+ if (!currentDocRouteMetadata) {
22
+ // We only render the not found content to avoid a double layout
23
+ // see https://github.com/facebook/docusaurus/pull/7966#pullrequestreview-1077276692
24
+ return <NotFoundContent />;
25
+ }
26
+ const {docElement, sidebarName, sidebarItems} = currentDocRouteMetadata;
27
+ return (
28
+ <HtmlClassNameProvider className={clsx(ThemeClassNames.page.docsDocPage)}>
29
+ <DocsSidebarProvider name={sidebarName} items={sidebarItems}>
30
+ <DocRootLayout>{docElement}</DocRootLayout>
31
+ </DocsSidebarProvider>
32
+ </HtmlClassNameProvider>
33
+ );
34
+ }
@@ -15,7 +15,6 @@ import {
15
15
  usePluralForm,
16
16
  } from '@docusaurus/theme-common';
17
17
  import Translate, {translate} from '@docusaurus/Translate';
18
- import Layout from '@theme/Layout';
19
18
  import SearchMetadata from '@theme/SearchMetadata';
20
19
  import type {Props} from '@theme/DocTagDocListPage';
21
20
 
@@ -37,6 +36,18 @@ function useNDocsTaggedPlural() {
37
36
  );
38
37
  }
39
38
 
39
+ function usePageTitle(props: Props): string {
40
+ const nDocsTaggedPlural = useNDocsTaggedPlural();
41
+ return translate(
42
+ {
43
+ id: 'theme.docs.tagDocListPageTitle',
44
+ description: 'The title of the page for a docs tag',
45
+ message: '{nDocsTagged} with "{tagName}"',
46
+ },
47
+ {nDocsTagged: nDocsTaggedPlural(props.tag.count), tagName: props.tag.label},
48
+ );
49
+ }
50
+
40
51
  function DocItem({doc}: {doc: Props['tag']['items'][number]}): JSX.Element {
41
52
  return (
42
53
  <article className="margin-vert--lg">
@@ -48,48 +59,55 @@ function DocItem({doc}: {doc: Props['tag']['items'][number]}): JSX.Element {
48
59
  );
49
60
  }
50
61
 
51
- export default function DocTagDocListPage({tag}: Props): JSX.Element {
52
- const nDocsTaggedPlural = useNDocsTaggedPlural();
53
- const title = translate(
54
- {
55
- id: 'theme.docs.tagDocListPageTitle',
56
- description: 'The title of the page for a docs tag',
57
- message: '{nDocsTagged} with "{tagName}"',
58
- },
59
- {nDocsTagged: nDocsTaggedPlural(tag.count), tagName: tag.label},
62
+ function DocTagDocListPageMetadata({
63
+ title,
64
+ }: Props & {title: string}): JSX.Element {
65
+ return (
66
+ <>
67
+ <PageMetadata title={title} />
68
+ <SearchMetadata tag="doc_tag_doc_list" />
69
+ </>
60
70
  );
71
+ }
61
72
 
73
+ function DocTagDocListPageContent({
74
+ tag,
75
+ title,
76
+ }: Props & {title: string}): JSX.Element {
62
77
  return (
63
78
  <HtmlClassNameProvider
64
- className={clsx(
65
- ThemeClassNames.wrapper.docsPages,
66
- ThemeClassNames.page.docsTagDocListPage,
67
- )}>
68
- <PageMetadata title={title} />
69
- <SearchMetadata tag="doc_tag_doc_list" />
70
- <Layout>
71
- <div className="container margin-vert--lg">
72
- <div className="row">
73
- <main className="col col--8 col--offset-2">
74
- <header className="margin-bottom--xl">
75
- <h1>{title}</h1>
76
- <Link href={tag.allTagsPath}>
77
- <Translate
78
- id="theme.tags.tagsPageLink"
79
- description="The label of the link targeting the tag list page">
80
- View All Tags
81
- </Translate>
82
- </Link>
83
- </header>
84
- <section className="margin-vert--lg">
85
- {tag.items.map((doc) => (
86
- <DocItem key={doc.id} doc={doc} />
87
- ))}
88
- </section>
89
- </main>
90
- </div>
79
+ className={clsx(ThemeClassNames.page.docsTagDocListPage)}>
80
+ <div className="container margin-vert--lg">
81
+ <div className="row">
82
+ <main className="col col--8 col--offset-2">
83
+ <header className="margin-bottom--xl">
84
+ <h1>{title}</h1>
85
+ <Link href={tag.allTagsPath}>
86
+ <Translate
87
+ id="theme.tags.tagsPageLink"
88
+ description="The label of the link targeting the tag list page">
89
+ View All Tags
90
+ </Translate>
91
+ </Link>
92
+ </header>
93
+ <section className="margin-vert--lg">
94
+ {tag.items.map((doc) => (
95
+ <DocItem key={doc.id} doc={doc} />
96
+ ))}
97
+ </section>
98
+ </main>
91
99
  </div>
92
- </Layout>
100
+ </div>
93
101
  </HtmlClassNameProvider>
94
102
  );
95
103
  }
104
+
105
+ export default function DocTagDocListPage(props: Props): JSX.Element {
106
+ const title = usePageTitle(props);
107
+ return (
108
+ <>
109
+ <DocTagDocListPageMetadata {...props} title={title} />
110
+ <DocTagDocListPageContent {...props} title={title} />
111
+ </>
112
+ );
113
+ }
@@ -13,31 +13,46 @@ import {
13
13
  ThemeClassNames,
14
14
  translateTagsPageTitle,
15
15
  } from '@docusaurus/theme-common';
16
- import Layout from '@theme/Layout';
17
16
  import TagsListByLetter from '@theme/TagsListByLetter';
18
17
  import SearchMetadata from '@theme/SearchMetadata';
19
18
  import type {Props} from '@theme/DocTagsListPage';
20
19
 
21
- export default function DocTagsListPage({tags}: Props): JSX.Element {
22
- const title = translateTagsPageTitle();
20
+ function DocTagsListPageMetadata({
21
+ title,
22
+ }: Props & {title: string}): JSX.Element {
23
23
  return (
24
- <HtmlClassNameProvider
25
- className={clsx(
26
- ThemeClassNames.wrapper.docsPages,
27
- ThemeClassNames.page.docsTagsListPage,
28
- )}>
24
+ <>
29
25
  <PageMetadata title={title} />
30
26
  <SearchMetadata tag="doc_tags_list" />
31
- <Layout>
32
- <div className="container margin-vert--lg">
33
- <div className="row">
34
- <main className="col col--8 col--offset-2">
35
- <h1>{title}</h1>
36
- <TagsListByLetter tags={tags} />
37
- </main>
38
- </div>
27
+ </>
28
+ );
29
+ }
30
+
31
+ function DocTagsListPageContent({
32
+ tags,
33
+ title,
34
+ }: Props & {title: string}): JSX.Element {
35
+ return (
36
+ <HtmlClassNameProvider
37
+ className={clsx(ThemeClassNames.page.docsTagsListPage)}>
38
+ <div className="container margin-vert--lg">
39
+ <div className="row">
40
+ <main className="col col--8 col--offset-2">
41
+ <h1>{title}</h1>
42
+ <TagsListByLetter tags={tags} />
43
+ </main>
39
44
  </div>
40
- </Layout>
45
+ </div>
41
46
  </HtmlClassNameProvider>
42
47
  );
43
48
  }
49
+
50
+ export default function DocTagsListPage(props: Props): JSX.Element {
51
+ const title = translateTagsPageTitle();
52
+ return (
53
+ <>
54
+ <DocTagsListPageMetadata {...props} title={title} />
55
+ <DocTagsListPageContent {...props} title={title} />
56
+ </>
57
+ );
58
+ }
@@ -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 {HtmlClassNameProvider, PageMetadata} from '@docusaurus/theme-common';
10
+ import {
11
+ docVersionSearchTag,
12
+ DocsVersionProvider,
13
+ } from '@docusaurus/theme-common/internal';
14
+ import renderRoutes from '@docusaurus/renderRoutes';
15
+ import SearchMetadata from '@theme/SearchMetadata';
16
+
17
+ import type {Props} from '@theme/DocVersionRoot';
18
+
19
+ function DocVersionRootMetadata(props: Props): JSX.Element {
20
+ const {version} = props;
21
+ return (
22
+ <>
23
+ <SearchMetadata
24
+ version={version.version}
25
+ tag={docVersionSearchTag(version.pluginId, version.version)}
26
+ />
27
+ <PageMetadata>
28
+ {version.noIndex && <meta name="robots" content="noindex, nofollow" />}
29
+ </PageMetadata>
30
+ </>
31
+ );
32
+ }
33
+
34
+ function DocVersionRootContent(props: Props): JSX.Element {
35
+ const {version, route} = props;
36
+ return (
37
+ <HtmlClassNameProvider className={version.className}>
38
+ <DocsVersionProvider version={version}>
39
+ {renderRoutes(route.routes!)}
40
+ </DocsVersionProvider>
41
+ </HtmlClassNameProvider>
42
+ );
43
+ }
44
+ export default function DocVersionRoot(props: Props): JSX.Element {
45
+ return (
46
+ <>
47
+ <DocVersionRootMetadata {...props} />
48
+ <DocVersionRootContent {...props} />
49
+ </>
50
+ );
51
+ }
@@ -0,0 +1,22 @@
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 {ThemeClassNames, HtmlClassNameProvider} from '@docusaurus/theme-common';
11
+ import renderRoutes from '@docusaurus/renderRoutes';
12
+ import Layout from '@theme/Layout';
13
+
14
+ import type {Props} from '@theme/DocVersionRoot';
15
+
16
+ export default function DocsRoot(props: Props): JSX.Element {
17
+ return (
18
+ <HtmlClassNameProvider className={clsx(ThemeClassNames.wrapper.docsPages)}>
19
+ <Layout>{renderRoutes(props.route.routes!)}</Layout>
20
+ </HtmlClassNameProvider>
21
+ );
22
+ }
@@ -0,0 +1,44 @@
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 Translate from '@docusaurus/Translate';
11
+ import type {Props} from '@theme/NotFound/Content';
12
+
13
+ export default function NotFoundContent({className}: Props): JSX.Element {
14
+ return (
15
+ <main className={clsx('container margin-vert--xl', className)}>
16
+ <div className="row">
17
+ <div className="col col--6 col--offset-3">
18
+ <h1 className="hero__title">
19
+ <Translate
20
+ id="theme.NotFound.title"
21
+ description="The title of the 404 page">
22
+ Page Not Found
23
+ </Translate>
24
+ </h1>
25
+ <p>
26
+ <Translate
27
+ id="theme.NotFound.p1"
28
+ description="The first paragraph of the 404 page">
29
+ We could not find what you were looking for.
30
+ </Translate>
31
+ </p>
32
+ <p>
33
+ <Translate
34
+ id="theme.NotFound.p2"
35
+ description="The 2nd paragraph of the 404 page">
36
+ Please contact the owner of the site that linked you to the
37
+ original URL and let them know their link is broken.
38
+ </Translate>
39
+ </p>
40
+ </div>
41
+ </div>
42
+ </main>
43
+ );
44
+ }
@@ -0,0 +1,27 @@
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 {translate} from '@docusaurus/Translate';
10
+ import {PageMetadata} from '@docusaurus/theme-common';
11
+ import Layout from '@theme/Layout';
12
+ import NotFoundContent from '@theme/NotFound/Content';
13
+
14
+ export default function Index(): JSX.Element {
15
+ const title = translate({
16
+ id: 'theme.NotFound.title',
17
+ message: 'Page Not Found',
18
+ });
19
+ return (
20
+ <>
21
+ <PageMetadata title={title} />
22
+ <Layout>
23
+ <NotFoundContent />
24
+ </Layout>
25
+ </>
26
+ );
27
+ }
@@ -379,17 +379,17 @@ declare module '@theme/DocItem/Footer' {
379
379
  export default function DocItemFooter(): JSX.Element;
380
380
  }
381
381
 
382
- declare module '@theme/DocPage/Layout' {
382
+ declare module '@theme/DocRoot/Layout' {
383
383
  import type {ReactNode} from 'react';
384
384
 
385
385
  export interface Props {
386
386
  readonly children: ReactNode;
387
387
  }
388
388
 
389
- export default function DocPageLayout(props: Props): JSX.Element;
389
+ export default function DocRootLayout(props: Props): JSX.Element;
390
390
  }
391
391
 
392
- declare module '@theme/DocPage/Layout/Sidebar' {
392
+ declare module '@theme/DocRoot/Layout/Sidebar' {
393
393
  import type {Dispatch, SetStateAction} from 'react';
394
394
  import type {PropSidebar} from '@docusaurus/plugin-content-docs';
395
395
 
@@ -399,20 +399,20 @@ declare module '@theme/DocPage/Layout/Sidebar' {
399
399
  readonly setHiddenSidebarContainer: Dispatch<SetStateAction<boolean>>;
400
400
  }
401
401
 
402
- export default function DocPageLayoutSidebar(props: Props): JSX.Element;
402
+ export default function DocRootLayoutSidebar(props: Props): JSX.Element;
403
403
  }
404
404
 
405
- declare module '@theme/DocPage/Layout/Sidebar/ExpandButton' {
405
+ declare module '@theme/DocRoot/Layout/Sidebar/ExpandButton' {
406
406
  export interface Props {
407
407
  toggleSidebar: () => void;
408
408
  }
409
409
 
410
- export default function DocPageLayoutSidebarExpandButton(
410
+ export default function DocRootLayoutSidebarExpandButton(
411
411
  props: Props,
412
412
  ): JSX.Element;
413
413
  }
414
414
 
415
- declare module '@theme/DocPage/Layout/Main' {
415
+ declare module '@theme/DocRoot/Layout/Main' {
416
416
  import type {ReactNode} from 'react';
417
417
 
418
418
  export interface Props {
@@ -420,7 +420,7 @@ declare module '@theme/DocPage/Layout/Main' {
420
420
  readonly children: ReactNode;
421
421
  }
422
422
 
423
- export default function DocPageLayoutMain(props: Props): JSX.Element;
423
+ export default function DocRootLayoutMain(props: Props): JSX.Element;
424
424
  }
425
425
 
426
426
  declare module '@theme/DocPaginator' {
@@ -662,6 +662,14 @@ declare module '@theme/Heading' {
662
662
  export default function Heading(props: Props): JSX.Element;
663
663
  }
664
664
 
665
+ declare module '@theme/NotFound/Content' {
666
+ export interface Props {
667
+ readonly className?: string;
668
+ }
669
+
670
+ export default function NotFoundContent(props: Props): JSX.Element;
671
+ }
672
+
665
673
  declare module '@theme/Layout' {
666
674
  import type {ReactNode} from 'react';
667
675
 
@@ -1,67 +0,0 @@
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
- import {
10
- HtmlClassNameProvider,
11
- ThemeClassNames,
12
- PageMetadata,
13
- } from '@docusaurus/theme-common';
14
- import {
15
- docVersionSearchTag,
16
- DocsSidebarProvider,
17
- DocsVersionProvider,
18
- useDocRouteMetadata,
19
- } from '@docusaurus/theme-common/internal';
20
- import DocPageLayout from '@theme/DocPage/Layout';
21
- import NotFound from '@theme/NotFound';
22
- import SearchMetadata from '@theme/SearchMetadata';
23
- function DocPageMetadata(props) {
24
- const {versionMetadata} = props;
25
- return (
26
- <>
27
- <SearchMetadata
28
- version={versionMetadata.version}
29
- tag={docVersionSearchTag(
30
- versionMetadata.pluginId,
31
- versionMetadata.version,
32
- )}
33
- />
34
- <PageMetadata>
35
- {versionMetadata.noIndex && (
36
- <meta name="robots" content="noindex, nofollow" />
37
- )}
38
- </PageMetadata>
39
- </>
40
- );
41
- }
42
- export default function DocPage(props) {
43
- const {versionMetadata} = props;
44
- const currentDocRouteMetadata = useDocRouteMetadata(props);
45
- if (!currentDocRouteMetadata) {
46
- return <NotFound />;
47
- }
48
- const {docElement, sidebarName, sidebarItems} = currentDocRouteMetadata;
49
- return (
50
- <>
51
- <DocPageMetadata {...props} />
52
- <HtmlClassNameProvider
53
- className={clsx(
54
- // TODO: it should be removed from here
55
- ThemeClassNames.wrapper.docsPages,
56
- ThemeClassNames.page.docsDocPage,
57
- props.versionMetadata.className,
58
- )}>
59
- <DocsVersionProvider version={versionMetadata}>
60
- <DocsSidebarProvider name={sidebarName} items={sidebarItems}>
61
- <DocPageLayout>{docElement}</DocPageLayout>
62
- </DocsSidebarProvider>
63
- </DocsVersionProvider>
64
- </HtmlClassNameProvider>
65
- </>
66
- );
67
- }
@@ -1,52 +0,0 @@
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 Translate, {translate} from '@docusaurus/Translate';
9
- import {PageMetadata} from '@docusaurus/theme-common';
10
- import Layout from '@theme/Layout';
11
- export default function NotFound() {
12
- return (
13
- <>
14
- <PageMetadata
15
- title={translate({
16
- id: 'theme.NotFound.title',
17
- message: 'Page Not Found',
18
- })}
19
- />
20
- <Layout>
21
- <main className="container margin-vert--xl">
22
- <div className="row">
23
- <div className="col col--6 col--offset-3">
24
- <h1 className="hero__title">
25
- <Translate
26
- id="theme.NotFound.title"
27
- description="The title of the 404 page">
28
- Page Not Found
29
- </Translate>
30
- </h1>
31
- <p>
32
- <Translate
33
- id="theme.NotFound.p1"
34
- description="The first paragraph of the 404 page">
35
- We could not find what you were looking for.
36
- </Translate>
37
- </p>
38
- <p>
39
- <Translate
40
- id="theme.NotFound.p2"
41
- description="The 2nd paragraph of the 404 page">
42
- Please contact the owner of the site that linked you to the
43
- original URL and let them know their link is broken.
44
- </Translate>
45
- </p>
46
- </div>
47
- </div>
48
- </main>
49
- </Layout>
50
- </>
51
- );
52
- }