mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 06:50:36 +02:00
refactor(v2): extract out into standalone components (#1017)
This commit is contained in:
parent
a364aa531c
commit
e3d57d244b
6 changed files with 99 additions and 69 deletions
|
@ -1,6 +1,5 @@
|
|||
import React from 'react';
|
||||
import {Link} from 'react-router-dom';
|
||||
import styles from './styles.css';
|
||||
import Footer from '@theme/Footer'; // eslint-disable-line
|
||||
|
||||
/* eslint-disable react/prefer-stateless-function */
|
||||
export default class Layout extends React.Component {
|
||||
|
@ -11,21 +10,14 @@ export default class Layout extends React.Component {
|
|||
docsMetadatas = {},
|
||||
location,
|
||||
} = this.props;
|
||||
const docsFlatMetadatas = Object.values(docsMetadatas);
|
||||
const routeLinks = [...pagesMetadatas, ...docsFlatMetadatas].map(
|
||||
data =>
|
||||
data.permalink !== location.pathname && (
|
||||
<li key={data.permalink}>
|
||||
<Link to={data.permalink}>{data.permalink}</Link>
|
||||
</li>
|
||||
),
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
{children}
|
||||
<div className={styles.footer}>
|
||||
<ul className={styles.routeLinks}>{routeLinks}</ul>
|
||||
</div>
|
||||
<Footer
|
||||
docsMetadatas={docsMetadatas}
|
||||
location={location}
|
||||
pagesMetadatas={pagesMetadatas}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue