Gatsby setup for API docs
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import {object} from 'prop-types';
|
||||
import React from 'react';
|
||||
import {Page} from '../components/layout';
|
||||
import Module from '../components/Module';
|
||||
import {getHelper} from '../util/api';
|
||||
|
||||
function API({pageContext: {docs}}) {
|
||||
const helper = getHelper(docs);
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<h1>API</h1>
|
||||
{helper.modules
|
||||
.filter(module => module.visible)
|
||||
.map(module => (
|
||||
<Module key={module.id} module={module} />
|
||||
))}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
API.propTypes = {
|
||||
pageContext: object.isRequired
|
||||
};
|
||||
|
||||
export default API;
|
||||
@@ -0,0 +1,33 @@
|
||||
import {object} from 'prop-types';
|
||||
import React from 'react';
|
||||
import {Page} from '../components/layout';
|
||||
|
||||
function Info({pageContext: {docs}}) {
|
||||
return (
|
||||
<Page>
|
||||
<h1>API</h1>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>kind</th>
|
||||
<th>longname</th>
|
||||
<th>memberof</th>
|
||||
</tr>
|
||||
{docs.map(doc => (
|
||||
<tr key={doc.longname}>
|
||||
<td>{doc.kind}</td>
|
||||
<td>{doc.longname}</td>
|
||||
<td>{doc.memberof}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
Info.propTypes = {
|
||||
pageContext: object.isRequired
|
||||
};
|
||||
|
||||
export default Info;
|
||||
Reference in New Issue
Block a user