-
Notifications
You must be signed in to change notification settings - Fork 738
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (30 loc) · 1.1 KB
/
index.js
File metadata and controls
36 lines (30 loc) · 1.1 KB
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
import BrowserOnly from '@docusaurus/BrowserOnly';
import { useDoc } from '@docusaurus/plugin-content-docs/client';
import LLMButtons from '@site/src/components/LLMButtons';
import Heading from '@theme/Heading';
import MDXContent from '@theme/MDXContent';
import clsx from 'clsx';
import React from 'react';
import styles from './styles.module.css';
function useSyntheticTitle() {
const { metadata, frontMatter, contentTitle } = useDoc();
const shouldRender = !frontMatter.hide_title && typeof contentTitle === 'undefined';
if (!shouldRender) {
return null;
}
return metadata.title;
}
export default function DocItemContent({ children }) {
const syntheticTitle = useSyntheticTitle();
return (
<div className={clsx('markdown')}>
{syntheticTitle && (
<div className={styles.docItemContent}>
{syntheticTitle && <Heading as="h1">{syntheticTitle}</Heading>}
<BrowserOnly>{() => <LLMButtons />}</BrowserOnly>
</div>
)}
<MDXContent>{children}</MDXContent>
</div>
);
}