mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-21 13:06:58 +02:00
feat(v2): rewrite docs loading strategy (#1092)
* feat(v2): rewrite docs loading strategy * Prettify * Lint * Allow resolving from library root * minor changes, refactor * copyright header
This commit is contained in:
parent
c9243e8922
commit
13a21b2374
36 changed files with 520 additions and 327 deletions
37
v2/lib/theme/DocBody/index.js
Normal file
37
v2/lib/theme/DocBody/index.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React, {useContext, useEffect} from 'react';
|
||||
|
||||
import DocsPaginator from '@theme/DocsPaginator'; // eslint-disable-line
|
||||
import DocusaurusContext from '@docusaurus/context';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
|
||||
function DocBody(props) {
|
||||
const {children, metadata} = props;
|
||||
const context = useContext(DocusaurusContext);
|
||||
useEffect(() => {
|
||||
context.setContext({
|
||||
metadata,
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={styles.docContent}>
|
||||
<h1>{metadata.title}</h1>
|
||||
{children}
|
||||
</div>
|
||||
<div className={styles.paginatorContainer}>
|
||||
<DocsPaginator />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DocBody;
|
Loading…
Add table
Add a link
Reference in a new issue