Skip to content

Commit

Permalink
feat: Add a PageTitle component and update the reference templates to…
Browse files Browse the repository at this point in the history
… use them
  • Loading branch information
jerelmiller committed Jun 15, 2020
1 parent 1ecfb6e commit 42fb2a1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/components/PageTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import styles from './PageTitle.module.scss';

const PageTitle = ({ children }) => (
<h1 className={styles.pageTitle}>{children}</h1>
);

PageTitle.propTypes = {
children: PropTypes.node,
};

export default PageTitle;
4 changes: 4 additions & 0 deletions src/components/PageTitle.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.pageTitle {
font-size: 2.5rem;
margin-top: 0;
}
3 changes: 2 additions & 1 deletion src/templates/ApiReferenceTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import InlineCodeSnippet from '../components/InlineCodeSnippet';
import ReactMarkdown from 'react-markdown';
import Layout from '../components/Layout';
import PageTitle from '../components/PageTitle';
import MethodReference from '../components/MethodReference';
import TypeDefReference from '../components/TypeDefReference';
import ConstantReference from '../components/ConstantReference';
Expand All @@ -28,7 +29,7 @@ const ApiReferenceTemplate = ({ data }) => {
return (
<Layout>
<SEO title={title} description={description} />
<h1>{api}</h1>
<PageTitle>{api}</PageTitle>

<section
className={cx(templateStyles.section, templateStyles.description)}
Expand Down
3 changes: 2 additions & 1 deletion src/templates/ComponentReferenceTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import InlineCodeSnippet from '../components/InlineCodeSnippet';
import ReactMarkdown from 'react-markdown';
import ReferenceExample from '../components/ReferenceExample';
import Layout from '../components/Layout';
import PageTitle from '../components/PageTitle';
import MethodReference from '../components/MethodReference';
import SEO from '../components/Seo';
import PropList from '../components/PropList';
Expand Down Expand Up @@ -38,7 +39,7 @@ const ComponentReferenceTemplate = ({ data }) => {
return (
<Layout>
<SEO title={title} description={description} />
<h1>{component}</h1>
<PageTitle>{component}</PageTitle>
<section
className={cx(
templateStyles.section,
Expand Down

0 comments on commit 42fb2a1

Please sign in to comment.