chore: nits

This commit is contained in:
endiliey 2018-09-16 01:40:56 +08:00
parent 85f0fd69c0
commit 15a810fee5
3 changed files with 12 additions and 18 deletions

View file

@ -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 => {
const previousID = idx(docsMetadatas, [currentID, 'previous']);
if (previousID) {

View file

@ -22,16 +22,19 @@ export default class Docs extends React.Component {
{thisSidebar[categoryName].map(rawLinkID => {
const linkID = (language ? `${language}-` : '') + rawLinkID;
const linkMetadata = docsMetadatas[linkID];
if (!linkMetadata) {
throw new Error(
`Improper sidebars.json file, document with id '${linkID}' not found.`
);
}
const linkClassName =
linkID === thisID ? 'navListItemActive' : 'navListItem';
return (
linkMetadata && (
<li className={linkClassName} key={linkID}>
<Link className="navItem" to={linkMetadata.permalink}>
{linkMetadata.sidebar_label || linkMetadata.title}
</Link>
</li>
)
);
})}
</ul>

View file

@ -2,14 +2,7 @@ import React from 'react';
export default props => {
if (props.error) {
return (
<div>
Error!{' '}
<button type="button" onClick={props.retry}>
Retry
</button>
</div>
);
return <div align="center">Error 🔥🔥🔥</div>;
}
if (props.pastDelay) {
return <div align="center">Loading...</div>;