Skip to content

Commit 7ad25a4

Browse files
committed
Add link back to README in tests and benchmarks page
1 parent 2435970 commit 7ad25a4

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tools/docs/www/src/app.jsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ class App extends Component {
8383
const resources = this.state.packageResources[ match.params.pkg ];
8484
const hasTests = resources && resources.test;
8585
const hasBenchmarks = resources && resources.benchmark;
86+
const fullPkgPath = `/${match.params.version}/docs/api/@stdlib/${match.params.pkg}`;
8687

8788
// Render the README for the selected package:
8889
return (
8990
<Fragment>
9091
<nav className="navbar">
91-
{ hasBenchmarks ? <Link to={`/${match.params.version}/docs/api/@stdlib/${match.params.pkg}/benchmark.html`}>Benchmarks</Link> : null}
92-
{ hasTests ? <Link to={`/${match.params.version}/docs/api/@stdlib/${match.params.pkg}/test.html`}>Tests</Link> : null}
92+
{ hasBenchmarks ? <Link to={`${fullPkgPath}/benchmark.html`}>Benchmarks</Link> : null}
93+
{ hasTests ? <Link to={`${fullPkgPath}/test.html`}>Tests</Link> : null}
9394
{ resources ? <a href={`https://github.com/stdlib-js/stdlib/tree/${match.params.version}/lib/node_modules/@stdlib/${match.params.pkg}`}>Source</a> : null}
9495
</nav>
9596
<ReadmePage path={match.url} />
@@ -183,11 +184,13 @@ class App extends Component {
183184
} else {
184185
iframe = <h2><code>{match.params.pkg}</code> does not have any benchmarks.</h2>;
185186
}
187+
const fullPkgPath = `/${match.params.version}/docs/api/@stdlib/${match.params.pkg}`;
186188
return (
187189
<Fragment>
188190
<nav className="navbar">
189-
{ hasBenchmarks ? <Link to={`/${match.params.version}/docs/api/@stdlib/${match.params.pkg}/benchmark.html`}>Benchmarks</Link> : null}
190-
{ hasTests ? <Link to={`/${match.params.version}/docs/api/@stdlib/${match.params.pkg}/test.html`}>Tests</Link> : null}
191+
<Link to={fullPkgPath} >Back to README</Link>
192+
{ hasBenchmarks ? <Link to={`${fullPkgPath}/benchmark.html`}>Benchmarks</Link> : null}
193+
{ hasTests ? <Link to={`${fullPkgPath}/test.html`}>Tests</Link> : null}
191194
{ resources ? <a href={`https://github.com/stdlib-js/stdlib/tree/${match.params.version}/lib/node_modules/@stdlib/${match.params.pkg}`}>Source</a> : null}
192195
</nav>
193196
{iframe}
@@ -208,11 +211,13 @@ class App extends Component {
208211
} else {
209212
iframe = <h2><code>{match.params.pkg}</code> does not have any tests.</h2>;
210213
}
214+
const fullPkgPath = `/${match.params.version}/docs/api/@stdlib/${match.params.pkg}`;
211215
return (
212216
<Fragment>
213217
<nav className="navbar">
214-
{ hasBenchmarks ? <Link to={`/${match.params.version}/docs/api/@stdlib/${match.params.pkg}/benchmark.html`}>Benchmarks</Link> : null}
215-
{ hasTests ? <Link to={`/${match.params.version}/docs/api/@stdlib/${match.params.pkg}/test.html`}>Tests</Link> : null}
218+
<Link to={fullPkgPath} >Back to README</Link>
219+
{ hasBenchmarks ? <Link to={`${fullPkgPath}/benchmark.html`}>Benchmarks</Link> : null}
220+
{ hasTests ? <Link to={`${fullPkgPath}/test.html`}>Tests</Link> : null}
216221
{ resources ? <a href={`https://github.com/stdlib-js/stdlib/tree/${match.params.version}/lib/node_modules/@stdlib/${match.params.pkg}`}>Source</a> : null}
217222
</nav>
218223
{iframe}

0 commit comments

Comments
 (0)