mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 03:12:35 +02:00
chore: nits
This commit is contained in:
parent
85f0fd69c0
commit
15a810fee5
3 changed files with 12 additions and 18 deletions
|
@ -102,9 +102,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/* Get the titles of the previous and next ids so that we can use them */
|
||||||
Get the titles of the previous and next ids so that we can use them
|
|
||||||
*/
|
|
||||||
Object.keys(docsMetadatas).forEach(currentID => {
|
Object.keys(docsMetadatas).forEach(currentID => {
|
||||||
const previousID = idx(docsMetadatas, [currentID, 'previous']);
|
const previousID = idx(docsMetadatas, [currentID, 'previous']);
|
||||||
if (previousID) {
|
if (previousID) {
|
||||||
|
|
|
@ -22,16 +22,19 @@ export default class Docs extends React.Component {
|
||||||
{thisSidebar[categoryName].map(rawLinkID => {
|
{thisSidebar[categoryName].map(rawLinkID => {
|
||||||
const linkID = (language ? `${language}-` : '') + rawLinkID;
|
const linkID = (language ? `${language}-` : '') + rawLinkID;
|
||||||
const linkMetadata = docsMetadatas[linkID];
|
const linkMetadata = docsMetadatas[linkID];
|
||||||
|
if (!linkMetadata) {
|
||||||
|
throw new Error(
|
||||||
|
`Improper sidebars.json file, document with id '${linkID}' not found.`
|
||||||
|
);
|
||||||
|
}
|
||||||
const linkClassName =
|
const linkClassName =
|
||||||
linkID === thisID ? 'navListItemActive' : 'navListItem';
|
linkID === thisID ? 'navListItemActive' : 'navListItem';
|
||||||
return (
|
return (
|
||||||
linkMetadata && (
|
<li className={linkClassName} key={linkID}>
|
||||||
<li className={linkClassName} key={linkID}>
|
<Link className="navItem" to={linkMetadata.permalink}>
|
||||||
<Link className="navItem" to={linkMetadata.permalink}>
|
{linkMetadata.sidebar_label || linkMetadata.title}
|
||||||
{linkMetadata.sidebar_label || linkMetadata.title}
|
</Link>
|
||||||
</Link>
|
</li>
|
||||||
</li>
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -2,14 +2,7 @@ import React from 'react';
|
||||||
|
|
||||||
export default props => {
|
export default props => {
|
||||||
if (props.error) {
|
if (props.error) {
|
||||||
return (
|
return <div align="center">Error 🔥🔥🔥</div>;
|
||||||
<div>
|
|
||||||
Error!{' '}
|
|
||||||
<button type="button" onClick={props.retry}>
|
|
||||||
Retry
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (props.pastDelay) {
|
if (props.pastDelay) {
|
||||||
return <div align="center">Loading...</div>;
|
return <div align="center">Loading...</div>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue