mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 09:37:43 +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
25
v2/lib/theme/Footer/index.js
Normal file
25
v2/lib/theme/Footer/index.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import React from 'react';
|
||||
import {Link} from 'react-router-dom';
|
||||
|
||||
import styles from './styles.css';
|
||||
|
||||
function Footer(props) {
|
||||
const {pagesMetadatas, docsMetadatas, location} = 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 className={styles.footer}>
|
||||
<ul className={styles.routeLinks}>{routeLinks}</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Footer;
|
Loading…
Add table
Add a link
Reference in a new issue