mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-09 21:07:49 +00:00
WIP on styling
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
title: "Hello World",
|
title: "Hello World",
|
||||||
date: "2015-05-01T22:12:03.284Z",
|
date: "2015-05-01T22:12:03.284Z",
|
||||||
author: 'crutchcorn',
|
author: 'crutchcorn',
|
||||||
license: 'MIT'
|
license: 'MIT',
|
||||||
|
tags: ['pic', 'other']
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
{
|
{
|
||||||
title: "New Beginnings",
|
title: "New Beginnings",
|
||||||
description: "This is a custom description for SEO and Open Graph purposes, rather than the default generated excerpt. Simply add a description field to the frontmatter.",
|
description: "This is a custom description for SEO and Open Graph purposes, rather than the default generated excerpt. Simply add a description field to the frontmatter.",
|
||||||
author: 'joe'
|
author: 'joe',
|
||||||
|
date: "2015-05-06T23:46:37.121Z",
|
||||||
|
tags: ["new starts", "hi"]
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
id: '123',
|
id: '123',
|
||||||
file: 'file.txt'
|
file: 'file.txt'
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
tags: ['second', 'post']
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
// custom typefaces
|
|
||||||
import "typeface-montserrat"
|
|
||||||
import "typeface-merriweather"
|
|
||||||
|
|||||||
@@ -26,18 +26,6 @@ module.exports = {
|
|||||||
path: `./src/data`,
|
path: `./src/data`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
resolve: `gatsby-plugin-prefetch-google-fonts`,
|
|
||||||
options: {
|
|
||||||
fonts: [
|
|
||||||
{
|
|
||||||
family: `Archivo`,
|
|
||||||
variants: [`400`, `700`],
|
|
||||||
subsets: [`latin`]
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
resolve: `gatsby-transformer-remark`,
|
resolve: `gatsby-transformer-remark`,
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
console.log(post.node.fields.slug);
|
console.log(post.node.fields.slug);
|
||||||
|
|
||||||
createPage({
|
createPage({
|
||||||
path: `post${post.node.fields.slug}`,
|
path: `posts${post.node.fields.slug}`,
|
||||||
component: blogPost,
|
component: blogPost,
|
||||||
context: {
|
context: {
|
||||||
slug: post.node.fields.slug,
|
slug: post.node.fields.slug,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link } from "gatsby"
|
import { Link } from "gatsby"
|
||||||
import './style.css'
|
import './style.css'
|
||||||
import { rhythm, scale } from "../utils/typography"
|
|
||||||
|
|
||||||
class Layout extends React.Component {
|
class Layout extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
@@ -13,8 +12,6 @@ class Layout extends React.Component {
|
|||||||
header = (
|
header = (
|
||||||
<h1
|
<h1
|
||||||
style={{
|
style={{
|
||||||
...scale(1.5),
|
|
||||||
marginBottom: rhythm(1.5),
|
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -56,8 +53,6 @@ class Layout extends React.Component {
|
|||||||
style={{
|
style={{
|
||||||
marginLeft: `auto`,
|
marginLeft: `auto`,
|
||||||
marginRight: `auto`,
|
marginRight: `auto`,
|
||||||
maxWidth: rhythm(24),
|
|
||||||
padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<header>{header}</header>
|
<header>{header}</header>
|
||||||
|
|||||||
@@ -11,3 +11,7 @@
|
|||||||
p, h1, h2, h3, h4, h5, h6 {
|
p, h1, h2, h3, h4, h5, h6 {
|
||||||
font-family: 'Archivo', sans-serif;
|
font-family: 'Archivo', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--backgroundColor)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,36 +1,46 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link } from "gatsby"
|
import { Link } from "gatsby"
|
||||||
import cardStyles from "./style.css"
|
import cardStyles from "./style.module.css"
|
||||||
|
import Image from "gatsby-image"
|
||||||
|
|
||||||
class PostCard extends React.Component {
|
class PostCard extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const { title, authorName, date, tags, excerpt } = this.props
|
const { title, author, date, tags, excerpt, description, className, slug } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cardStyles.card}>
|
<Link to={`posts/${slug}`} className={`${cardStyles.card} ${className}`}>
|
||||||
<img src={"https://pbs.twimg.com/profile_images/1137822889938317312/Z9Ci2LoS_400x400.jpg"}
|
<Image
|
||||||
alt={`Image of ${authorName}`}
|
fixed={author.profileImg.childImageSharp.fixed}
|
||||||
className={cardStyles.profilePic} style={{
|
alt={author.name}
|
||||||
|
className={cardStyles.profilePic}
|
||||||
|
style={{
|
||||||
borderColor: "red",
|
borderColor: "red",
|
||||||
}}/>
|
}}
|
||||||
|
imgStyle={{
|
||||||
|
borderRadius: `50%`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<div className={cardStyles.cardContents}>
|
<div className={cardStyles.cardContents}>
|
||||||
<h2 className={cardStyles.header}>{title}</h2>
|
<h2 className={cardStyles.header}>{title}</h2>
|
||||||
<div className={cardStyles.authorSubheader}>
|
<div className={cardStyles.authorSubheader}>
|
||||||
<p>by {authorName}</p>
|
<p>by {author.name}</p>
|
||||||
<p className={cardStyles.date}>{date}</p>
|
<p className={cardStyles.date}>{date}</p>
|
||||||
|
<div>
|
||||||
{
|
{
|
||||||
tags.map(tag => (
|
tags.map(tag => (
|
||||||
<Link to={"/"} className={cardStyles.tag}>
|
<Link to={"/"} key={tag} className={cardStyles.tag}>
|
||||||
{tag.name}
|
{tag}
|
||||||
</Link>
|
</Link>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p className={cardStyles.excerpt}>
|
<p className={cardStyles.excerpt} dangerouslySetInnerHTML={{
|
||||||
{excerpt}
|
__html: description || excerpt,
|
||||||
</p>
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profilePic {
|
.profilePic {
|
||||||
height: 60px;
|
position: absolute !important;
|
||||||
width: 60px;
|
left: 12px;
|
||||||
|
top: 12px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
@@ -18,6 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
margin:0;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +29,12 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorSubheader p {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
@@ -37,18 +45,29 @@
|
|||||||
color: var(--darkPrimary);
|
color: var(--darkPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag, .date {
|
.tag:not(:first-child), .date {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag::before, .date::before {
|
.tag:not(:first-child)::before, .date::before, .date::after {
|
||||||
|
--height: 20px;
|
||||||
|
--halfHeight: calc(var(--height) / 2);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 50%;
|
||||||
height: 100%;
|
margin-top: calc(0px - var(--halfHeight));
|
||||||
left: 0;
|
height: var(--height);
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: var(--darkPrimary)
|
background: var(--darkPrimary);
|
||||||
|
content: ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag:not(:first-child)::before, .date::before {
|
||||||
|
left: -6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date::after {
|
||||||
|
right: -6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.excerpt {
|
.excerpt {
|
||||||
@@ -59,7 +78,8 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: 12px;
|
left: -12px;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
background: var(--darkPrimary)
|
background: var(--darkPrimary);
|
||||||
|
content: ' ';
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link, graphql } from "gatsby"
|
import { Link, graphql } from "gatsby"
|
||||||
|
|
||||||
import Bio from "../components/bio"
|
|
||||||
import Layout from "../components/layout"
|
import Layout from "../components/layout"
|
||||||
import SEO from "../components/seo"
|
import SEO from "../components/seo"
|
||||||
import { rhythm } from "../utils/typography"
|
import PostCard from "../components/post-card"
|
||||||
|
import listStyle from './index.module.css'
|
||||||
|
|
||||||
class BlogIndex extends React.Component {
|
class BlogIndex extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
@@ -15,29 +14,24 @@ class BlogIndex extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Layout location={this.props.location} title={siteTitle}>
|
<Layout location={this.props.location} title={siteTitle}>
|
||||||
<SEO title="All posts" />
|
<SEO title="All posts" />
|
||||||
|
<div className={listStyle.postsListContainer}>
|
||||||
{posts.map(({ node }) => {
|
{posts.map(({ node }) => {
|
||||||
const title = node.frontmatter.title || node.fields.slug
|
const title = node.frontmatter.title || node.fields.slug
|
||||||
return (
|
return (
|
||||||
<div key={node.fields.slug}>
|
<PostCard
|
||||||
<h3
|
slug={node.fields.slug}
|
||||||
style={{
|
className={listStyle.postListItem}
|
||||||
marginBottom: rhythm(1 / 4),
|
key={node.fields.slug}
|
||||||
}}
|
excerpt={node.excerpt}
|
||||||
>
|
title={title}
|
||||||
<Bio author={node.frontmatter.author} />
|
author={node.frontmatter.author}
|
||||||
<Link style={{ boxShadow: `none` }} to={`post/${node.fields.slug}`}>
|
date={node.frontmatter.date}
|
||||||
{title}
|
tags={node.frontmatter.tags}
|
||||||
</Link>
|
description={node.frontmatter.description}
|
||||||
</h3>
|
/>
|
||||||
<small>{node.frontmatter.date}</small>
|
|
||||||
<p
|
|
||||||
dangerouslySetInnerHTML={{
|
|
||||||
__html: node.frontmatter.description || node.excerpt,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -62,7 +56,7 @@ export const query = graphql`
|
|||||||
}
|
}
|
||||||
profileImg {
|
profileImg {
|
||||||
childImageSharp {
|
childImageSharp {
|
||||||
fixed(width: 50, height: 50) {
|
fixed(width: 60, height: 60) {
|
||||||
...GatsbyImageSharpFixed
|
...GatsbyImageSharpFixed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,6 +81,7 @@ export const pageQuery = graphql`
|
|||||||
frontmatter {
|
frontmatter {
|
||||||
date(formatString: "MMMM DD, YYYY")
|
date(formatString: "MMMM DD, YYYY")
|
||||||
title
|
title
|
||||||
|
tags
|
||||||
author {
|
author {
|
||||||
...AuthorInfo
|
...AuthorInfo
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/pages/index.module.css
Normal file
14
src/pages/index.module.css
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
.postsListContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postListItem {
|
||||||
|
flex-basis: calc(33% - 20px);
|
||||||
|
margin: 0 10px;
|
||||||
|
flex-grow: 0;
|
||||||
|
width: calc(33% - 20px);
|
||||||
|
max-width: calc(33% - 20px);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user