Skip to content

Commit

Permalink
feat: Start guide template
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaker committed Apr 23, 2020
1 parent c62133a commit 896a313
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
5 changes: 1 addition & 4 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {

const result = await graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 1000
) {
allMarkdownRemark(limit: 1000) {
edges {
node {
frontmatter {
Expand Down
8 changes: 8 additions & 0 deletions src/components/BreadcrumbBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import './BreadcrumbBar.scss';

const BreadcrumbBar = () => {
return <div className="breadcrumbBar">hey</div>;
};

export default BreadcrumbBar;
5 changes: 5 additions & 0 deletions src/components/BreadcrumbBar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.breadcrumbBar {
background: rgb(202, 201, 201);
height: 50px;
width: 100%;
}
8 changes: 4 additions & 4 deletions src/markdown-pages/example.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
path: "/docs/1"
date: "2020-04-20"
title: "My cool docs"
template: "example-template"
path: '/docs/1'
duration: '30 min'
title: 'Build an app'
template: 'GuideTemplate'
---

### This doc is great
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
import React from 'react';
import { graphql } from 'gatsby';
import PropTypes from 'prop-types';
import Layout from '../components/Layout';
import BreadcrumbBar from '../components/BreadcrumbBar';

export default function Template({
export default function GuideTemplate({
data, // this prop will be injected by the GraphQL query below.
}) {
const { markdownRemark } = data; // data.markdownRemark holds your post data
const { frontmatter, html } = markdownRemark;
return (
<div className="doc-container">
<div className="doc">
<h1>{frontmatter.title}</h1>
<h2>{frontmatter.date}</h2>
<div
className="doc-content"
dangerouslySetInnerHTML={{ __html: html }}
/>
<Layout>
<BreadcrumbBar />
<div className="guideTemplate-container">
<div>
<h1>{frontmatter.title}</h1>
<h2>{frontmatter.duration}</h2>
<div
className="guideTemplate-content"
dangerouslySetInnerHTML={{ __html: html }}
/>
</div>
</div>
</div>
</Layout>
);
}
export const pageQuery = graphql`
query($path: String!) {
markdownRemark(frontmatter: { path: { eq: $path } }) {
html
frontmatter {
date(formatString: "MMMM DD, YYYY")
duration
path
title
}
}
}
`;
Template.propTypes = {
GuideTemplate.propTypes = {
data: PropTypes.object,
};
Empty file.

0 comments on commit 896a313

Please sign in to comment.