Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
bagseye committed Aug 20, 2020
2 parents ead3670 + ce05845 commit d61733f
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 250 deletions.
6 changes: 3 additions & 3 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ exports.createPages = async ({ actions, graphql }) => {

// Create blog list pages
const posts = result.data.allMarkdownRemark.edges
const postsPerPage = 1
const postsPerPage = 10 // Change for number posts to display per page
const numPages = Math.ceil(posts.length / postsPerPage)
Array.from({ length: numPages }).forEach((_, i) => {
createPage({
path: i === 0 ? `/blog` : `/${i + 1}`,
component: path.resolve("./src/templates/blog-list-template.js"),
path: i === 0 ? `/journal` : `/journal/${i + 1}`,
component: path.resolve("./src/templates/journal-template.js"),
context: {
limit: postsPerPage,
skip: i * postsPerPage,
Expand Down
12 changes: 6 additions & 6 deletions src/components/Blog/blog-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ const BlogContent = styled.div`
}
`

const BlogList = props => {
const BlogList = ({ key, title, excerpt, path, date }) => {
return (
<BlogItem key={props.key}>
<BlogItem key={key}>
<BlogTitle>
<h2>{props.title}</h2>
<h2>{title}</h2>
</BlogTitle>
<BlogContent>
<p>{props.excerpt}</p>
<p>{excerpt}</p>
<BlogMeta>
<Link className="btn-link" to={props.path}>
<Link className="btn-link" to={path}>
<Button />
</Link>
<h4>{props.date}</h4>
<h4>{date}</h4>
</BlogMeta>
</BlogContent>
</BlogItem>
Expand Down
16 changes: 11 additions & 5 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import React from "react"
import { graphql } from "gatsby"
import Layout from "../components/layout"
import styles from "../scss/blog.module.scss"
import Seo from "../components/SEO"
import BlogItem from "../components/Blog/blog-item"
import styled from "styled-components"

const FeaturedItems = styled.h4`
font-size: 1.2rem;
color: #939393;
`

export default ({ data }) => {
const { allMarkdownRemark } = data
return (
<Layout>
<Seo />
<h1>
My name is Bonneville. I'm a starter theme for Gatsby and I like to talk
as if I am a living thing
</h1>
<h4 className={styles.feature}>
{data.allMarkdownRemark.totalCount} Featured Posts
</h4>
{data.allMarkdownRemark.edges.map(({ node }) => (
<FeaturedItems>
{allMarkdownRemark.totalCount} Featured Posts
</FeaturedItems>
{allMarkdownRemark.edges.map(({ node }) => (
<BlogItem
title={node.frontmatter.title}
excerpt={node.excerpt}
Expand Down
55 changes: 0 additions & 55 deletions src/pages/journal.js

This file was deleted.

96 changes: 0 additions & 96 deletions src/scss/blog.module.scss

This file was deleted.

85 changes: 0 additions & 85 deletions src/templates/blog-list-template.js

This file was deleted.

Loading

0 comments on commit d61733f

Please sign in to comment.