From 0eaf3f95cf417630a2f228233ffc55d1f3b078da Mon Sep 17 00:00:00 2001 From: LBlend Date: Sat, 31 Jul 2021 15:32:02 +0200 Subject: [PATCH] initial blogpost styling --- src/components/pages/blogPost.js | 55 +++++----------- src/components/pages/blogPost.module.css | 82 ++++++++++++++++++------ 2 files changed, 77 insertions(+), 60 deletions(-) diff --git a/src/components/pages/blogPost.js b/src/components/pages/blogPost.js index ac2186f..b1b7bad 100644 --- a/src/components/pages/blogPost.js +++ b/src/components/pages/blogPost.js @@ -3,7 +3,7 @@ import * as styles from "./blogPost.module.css" import Seo from "../seo" import { graphql } from "gatsby" import { GatsbyImage } from "gatsby-plugin-image" -import PortableText from "@sanity/block-content-to-react" +import BlockContent from "@sanity/block-content-to-react" import urlBuilder from "@sanity/image-url" export const query = graphql` @@ -15,7 +15,7 @@ export const query = graphql` name image { asset { - gatsbyImageData(width: 64, height: 64) + gatsbyImageData(width: 50, height: 50) } } } @@ -26,36 +26,11 @@ export const query = graphql` } } excerpt - body { - children { - _key - _type - text - marks - } - _type - list - style - } + _rawBody(resolveReferences: { maxDepth: 10 }) } } ` -const urlFor = source => - urlBuilder({ projectId: "mmqlu667", dataset: "production" }).image(source) - -const serializer = { - types: { - mainImage: props => ( -
- - -
{props.node.caption}
-
- ), - }, -} - const BlogPost = ({ data }) => { return ( <> @@ -66,28 +41,28 @@ const BlogPost = ({ data }) => { author={data.sanityPost.author.name} />
-
-
-

{data.sanityPost._createdAt}

+
+
-

{data.sanityPost.title}

-

{data.sanityPost.excerpt}

+

{data.sanityPost.title}

+

{data.sanityPost.excerpt}

-

{data.sanityPost.author.name}

+
+

{data.sanityPost.author.name}

+

{data.sanityPost._createdAt}

+
-
- -
+
diff --git a/src/components/pages/blogPost.module.css b/src/components/pages/blogPost.module.css index c17448b..101bcde 100644 --- a/src/components/pages/blogPost.module.css +++ b/src/components/pages/blogPost.module.css @@ -5,31 +5,29 @@ .article { display: grid; place-items: center; - padding: 3rem 1rem; + padding: 1rem 0; } -.header { - border-bottom: var(--blog-header-divider); - padding-bottom: 1rem; - margin-bottom: 3rem; +.header > * { + padding: 0 1rem; } -.headerImage { - max-height: 75vh; - margin: 1rem 0; - max-width: 1280px; -} -h1 { - font-size: 3rem; - line-height: 1; - padding: 1.5rem 0; -} -.content { - max-width: 60ch; -} - .published { font-weight: 100; } - +.headerImage { + padding: 0; + margin: 1rem 0; + max-width: 85ch; + max-height: 80vh; +} +.title { + font-size: 3rem; + line-height: 1; + margin: 1.5rem 0; +} +.excerpt { + max-width: none; + margin-bottom: 1rem; +} .author { display: grid; grid-template-columns: auto 1fr; @@ -37,7 +35,51 @@ h1 { gap: 0.5em; font-weight: 100; } +.authorNameSection { + display: flex; + flex-direction: column; +} .author img { border-radius: 50%; border: 2px solid white; } +.article { + display: grid; + gap: 2em; +} +.content { + display: grid; + gap: 1rem; + max-width: 60ch; + padding: 0 1rem; +} + +/* Block content styling */ +.content h1, +h2, +h3, +h4 { + padding-inline-start: 1rem; + border-inline-start: 8px solid var(--main-color); +} +.content blockquote { + color: rgb(225, 225, 225); + font-weight: 100; + padding-inline-start: 2rem; + border-inline-start: 2px solid var(--link-color-hover); +} + +/* .content blockquote::before { + content: '"'; + font-size: 3rem; +} +.content blockquote::after { + content: '"'; + font-size: 3rem; +} */ + +@media (min-width: 60em) { + .content { + padding: 0; + } +}