Skip to content

Commit

Permalink
feat: use PageLayout for ApiReferenceTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jul 30, 2020
1 parent 027a893 commit 11d156e
Showing 1 changed file with 48 additions and 45 deletions.
93 changes: 48 additions & 45 deletions src/templates/ApiReferenceTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cx from 'classnames';
import { graphql } from 'gatsby';
import PropTypes from 'prop-types';
import { CodeBlock } from '@newrelic/gatsby-theme-newrelic';
import PageTitle from '../components/PageTitle';
import PageLayout from '../components/PageLayout';
import Markdown from '../components/Markdown';
import MethodReference from '../components/MethodReference';
import TypeDefReference from '../components/TypeDefReference';
Expand All @@ -28,55 +28,58 @@ const ApiReferenceTemplate = ({ data }) => {
return (
<>
<SEO title={title} description={description} />
<PageTitle>{api}</PageTitle>

{apiDescription && (
<section
className={cx(
templateStyles.section,
templateStyles.description,
'intro-text'
<PageLayout type={PageLayout.TYPE.SINGLE_COLUMN}>
<PageLayout.Header title={api} />
<PageLayout.Content>
{apiDescription && (
<section
className={cx(
templateStyles.section,
templateStyles.description,
'intro-text'
)}
>
<Markdown source={apiDescription} />
</section>
)}
>
<Markdown source={apiDescription} />
</section>
)}

<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>Usage</h2>
<CodeBlock language="js">{usage}</CodeBlock>
</section>
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>Usage</h2>
<CodeBlock language="js">{usage}</CodeBlock>
</section>

{methods.length > 0 && (
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>API methods</h2>
{methods.map((method, i) => (
<MethodReference
key={i}
method={method}
className={templateStyles.section}
/>
))}
</section>
)}
{methods.length > 0 && (
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>API methods</h2>
{methods.map((method, i) => (
<MethodReference
key={i}
method={method}
className={templateStyles.section}
/>
))}
</section>
)}

{typeDefs.length > 0 && (
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>Type definitions</h2>
{typeDefs.map((typeDef, i) => (
<TypeDefReference key={i} typeDef={typeDef} />
))}
</section>
)}
{typeDefs.length > 0 && (
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>Type definitions</h2>
{typeDefs.map((typeDef, i) => (
<TypeDefReference key={i} typeDef={typeDef} />
))}
</section>
)}

{constants.length > 0 && (
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>Constants</h2>
{constants.map((constant, i) => (
<ConstantReference key={i} constant={constant} />
))}
</section>
)}
{constants.length > 0 && (
<section className={templateStyles.section}>
<h2 className={templateStyles.sectionTitle}>Constants</h2>
{constants.map((constant, i) => (
<ConstantReference key={i} constant={constant} />
))}
</section>
)}
</PageLayout.Content>
</PageLayout>
</>
);
};
Expand Down

0 comments on commit 11d156e

Please sign in to comment.