Skip to content

Commit ea67361

Browse files
committed
update at 2024-04-11 12:17:30
1 parent 7ec133b commit ea67361

File tree

3 files changed

+30
-74
lines changed

3 files changed

+30
-74
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import DocCategoryGeneratedIndexPage from '@theme-original/DocCategoryGeneratedIndexPage';
3+
import type DocCategoryGeneratedIndexPageType from '@theme/DocCategoryGeneratedIndexPage';
4+
import type { WrapperProps } from '@docusaurus/types';
5+
// highlight-add-line
6+
import Comment from '@site/src/components/Comment';
7+
8+
type Props = WrapperProps<typeof DocCategoryGeneratedIndexPageType>;
9+
10+
export default function DocCategoryGeneratedIndexPageWrapper(props: Props): JSX.Element {
11+
return (
12+
<>
13+
<DocCategoryGeneratedIndexPage {...props} />
14+
{/* highlight-add-line */}
15+
<Comment />
16+
</>
17+
);
18+
}

src/theme/DocItem/Layout/index.tsx

+12-64
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,18 @@
11
import React from 'react';
2-
import clsx from 'clsx';
3-
import { useWindowSize } from '@docusaurus/theme-common';
4-
import { useDoc } from '@docusaurus/theme-common/internal';
5-
import DocItemPaginator from '@theme/DocItem/Paginator';
6-
import DocVersionBanner from '@theme/DocVersionBanner';
7-
import DocVersionBadge from '@theme/DocVersionBadge';
8-
import DocItemFooter from '@theme/DocItem/Footer';
9-
import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
10-
import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
11-
import DocItemContent from '@theme/DocItem/Content';
12-
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
13-
import Unlisted from '@theme/Unlisted';
14-
import type { Props } from '@theme/DocItem/Layout';
2+
import Layout from '@theme-original/DocItem/Layout';
3+
import type LayoutType from '@theme/DocItem/Layout';
4+
import type { WrapperProps } from '@docusaurus/types';
5+
// highlight-add-line
6+
import Comment from '@site/src/components/Comment';
157

16-
import styles from './styles.module.css';
17-
import Comment from '../../../components/Comment';
8+
type Props = WrapperProps<typeof LayoutType>;
189

19-
/**
20-
* Decide if the toc should be rendered, on mobile or desktop viewports
21-
*/
22-
function useDocTOC() {
23-
const { frontMatter, toc } = useDoc();
24-
const windowSize = useWindowSize();
25-
26-
const hidden = frontMatter.hide_table_of_contents;
27-
const canRender = !hidden && toc.length > 0;
28-
29-
const mobile = canRender ? <DocItemTOCMobile /> : undefined;
30-
31-
const desktop =
32-
canRender && (windowSize === 'desktop' || windowSize === 'ssr') ? (
33-
<DocItemTOCDesktop />
34-
) : undefined;
35-
36-
return {
37-
hidden,
38-
mobile,
39-
desktop,
40-
};
41-
}
42-
43-
export default function DocItemLayout({ children }: Props): JSX.Element {
44-
const docTOC = useDocTOC();
45-
const { frontMatter } = useDoc();
46-
const { hide_comment: hideComment } = frontMatter;
47-
const {
48-
metadata: { unlisted },
49-
} = useDoc();
10+
export default function LayoutWrapper(props: Props): JSX.Element {
5011
return (
51-
<div className="row">
52-
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
53-
{unlisted && <Unlisted />}
54-
<DocVersionBanner />
55-
<div className={styles.docItemContainer}>
56-
<article>
57-
<DocBreadcrumbs />
58-
<DocVersionBadge />
59-
{docTOC.mobile}
60-
<DocItemContent>{children}</DocItemContent>
61-
<DocItemFooter />
62-
</article>
63-
<DocItemPaginator />
64-
</div>
65-
{!hideComment && <Comment />}
66-
</div>
67-
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
68-
</div>
12+
<>
13+
<Layout {...props} />
14+
{/* highlight-add-line */}
15+
<Comment />
16+
</>
6917
);
7018
}

src/theme/DocItem/Layout/styles.module.css

-10
This file was deleted.

0 commit comments

Comments
 (0)