-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
/
Copy pathindex.tsx
77 lines (72 loc) · 2.22 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import {
PageMetadata,
useCurrentSidebarCategory,
} from '@docusaurus/theme-common';
import useBaseUrl from '@docusaurus/useBaseUrl';
import DocCardList from '@theme/DocCardList';
import DocPaginator from '@theme/DocPaginator';
import DocVersionBanner from '@theme/DocVersionBanner';
import DocVersionBadge from '@theme/DocVersionBadge';
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
import Heading from '@theme/Heading';
import type {Props} from '@theme/DocCategoryGeneratedIndexPage';
import styles from './styles.module.css';
function DocCategoryGeneratedIndexPageMetadata({
categoryGeneratedIndex,
}: Props): JSX.Element {
return (
<PageMetadata
title={categoryGeneratedIndex.title}
description={categoryGeneratedIndex.description}
keywords={categoryGeneratedIndex.keywords}
// TODO `require` this?
image={useBaseUrl(categoryGeneratedIndex.image)}
/>
);
}
function DocCategoryGeneratedIndexPageContent({
categoryGeneratedIndex,
}: Props): JSX.Element {
const category = useCurrentSidebarCategory();
return (
<div className={styles.generatedIndexPage}>
<DocVersionBanner />
<DocBreadcrumbs />
<DocVersionBadge />
<header>
<Heading as="h1" className={styles.title}>
{categoryGeneratedIndex.title}
</Heading>
{categoryGeneratedIndex.description && (
<p>{categoryGeneratedIndex.description}</p>
)}
</header>
<article className="margin-top--lg">
<DocCardList items={category.items} className={styles.list} />
</article>
<footer className="margin-top--lg">
<DocPaginator
previous={categoryGeneratedIndex.navigation.previous}
next={categoryGeneratedIndex.navigation.next}
/>
</footer>
</div>
);
}
export default function DocCategoryGeneratedIndexPage(
props: Props,
): JSX.Element {
return (
<>
<DocCategoryGeneratedIndexPageMetadata {...props} />
<DocCategoryGeneratedIndexPageContent {...props} />
</>
);
}