Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Commit 9545035

Browse files
author
Colin McDonnell
committed
Formatting and CSS improvements
2 parents 846f1ee + 8fc3e43 commit 9545035

File tree

18 files changed

+108
-93
lines changed

18 files changed

+108
-93
lines changed

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<p align="center">
88
if you're happy and you know it, star this repo
99
</p>
10-
</p>
1110
<p align="center">
1211
<a href="https://opensource.org/licenses/MIT" rel="nofollow">
13-
<img src="https://img.shields.io/github/license/vriad/devii?alt" alt="License" style="width:100px;">
12+
<img src="https://img.shields.io/github/license/vriad/devii?alt" alt="License" style="width:100px;">
1413
</a>
1514
</p>
15+
1616
<br/>
1717
<br/>
1818
<br/>
@@ -29,13 +29,15 @@ A dev blog starter for 2020.
2929

3030
Read more about the motivation + design behind Devii at [https://vriad.com/blog/devii](https://vriad.com/blog/devii).
3131

32-
<!-- # Sponsor
32+
<!--
3333
34+
# Sponsor
3435
Big thanks to this week's Devii sponsor! Check out what they have to offer.
35-
3636
<a href="https://tracking.gitads.io/?repo=devii">
3737
<img src="https://images.gitads.io/devii" alt="GitAds"/>
38-
</a> -->
38+
</a>
39+
40+
-->
3941

4042
# Get started
4143

@@ -76,10 +78,12 @@ Here's is an abbreviated version of the project structure. Certain config files
7678
| ├── devii.md // this page!
7779
├── whatever.md // every MD file in this directory becomes a blog post
7880
├── components
81+
| ├── BlogPost.tsx
7982
| ├── Code.tsx
80-
| ├── Markdown.tsx
81-
| ├── Header.tsx
83+
| ├── Footer.tsx
8284
| ├── Header.tsx
85+
| ├── Markdown.tsx
86+
| ├── Meta.tsx
8387
| ├── <various>
8488
├── loader.ts // contains utility functions for loading/parsing Markdown
8589
├── node_modules
@@ -113,10 +117,6 @@ Just add a Markdown file under `md/blog/` to create a new blog post:
113117
2. Add in some basic Markdown content
114118
3. Then go to `http://localhost:3000/blog/foo`. You should see the new post.
115119

116-
## Google Analytics
117-
118-
Just add your Google Analytics ID (e.g. 'UA-999999999-1') to `globals.ts` and Devii will automatically add the appropriate Google Analytics snippet to your site. Go to `/pages/_app.ts` to see how this works or customize this behavior.
119-
120120
## Frontmatter support
121121

122122
Every Markdown file can include a "frontmatter block" containing various metadata. Devii provides a `loadPost` utility that loads a Markdown file, parses it's frontmatter metadata, and returns a structured `PostData` object:
@@ -157,6 +157,10 @@ thumbnailPhoto: /brook.jpg
157157

158158
View `/loader.ts` to see how this works.
159159

160+
## Google Analytics
161+
162+
Just add your Google Analytics ID (e.g. 'UA-999999999-1') to `globals.ts` and Devii will automatically add the appropriate Google Analytics snippet to your site. Go to `/pages/_app.ts` to see how this works or customize this behavior.
163+
160164
## Medium-inspired design
161165

162166
The Markdown renderer (`Markdown.tsx`) provides a default style inspired by Medium. Just modify the CSS in `Markdown.tsx` to customize the design to your liking.

components/Author.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
2-
// import { gwen } from 'gwen';
32
import { format } from 'fecha';
4-
53
import { PostData } from '../loader';
64
import { globals } from '../globals';
75

@@ -69,22 +67,21 @@ export const AuthorLines: React.FC<{ post: PostData }> = (props) => {
6967
return (
7068
<div>
7169
<p style={{ ...lineStyle }}>
72-
{props.post.author ? props.post.author : ''}
70+
{props.post.author
71+
? props.post.author
72+
: ''}
7373
</p>
74-
7574
<p style={{ opacity: 0.6, ...lineStyle }}>
7675
{props.post.datePublished
7776
? format(new Date(props.post.datePublished), 'MMMM Do, YYYY')
7877
: ''}
7978
</p>
80-
8179
<p style={{ ...lineStyle }}>
8280
{props.post.authorTwitter && (
8381
<a
8482
style={{
8583
textDecoration: 'none',
8684
color: '#3b9488',
87-
// fontSize: '110%',
8885
}}
8986
href={`https://twitter.com/${props.post.authorTwitter}`}
9087
>{`@${props.post.authorTwitter}`}</a>

components/BlogPost.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
32
import { Markdown } from './Markdown';
43
import { PostData } from '../loader';
54
import { PostMeta } from './PostMeta';
@@ -9,7 +8,6 @@ export const BlogPost: React.FunctionComponent<{ post: PostData }> = ({
98
post,
109
}) => {
1110
const { title, subtitle } = post;
12-
1311
return (
1412
<div
1513
style={{
@@ -26,7 +24,6 @@ export const BlogPost: React.FunctionComponent<{ post: PostData }> = ({
2624
<img
2725
style={{
2826
width: '100%',
29-
// maxHeight: '350px',
3027
maxWidth: '100%',
3128
margin: '0px',
3229
}}
@@ -66,7 +63,6 @@ export const BlogPost: React.FunctionComponent<{ post: PostData }> = ({
6663
margin: '25px 0px',
6764
}}
6865
/>
69-
7066
<Author post={post} />
7167
</div>
7268

components/Code.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ export default class Code extends React.PureComponent<{
88
}> {
99
render() {
1010
const { language, value } = this.props;
11-
1211
return (
1312
<SyntaxHighlighter
14-
language={(language === 'ts' ? 'typescript' : language) || 'typescript'}
13+
language={(language === 'ts'
14+
? 'typescript'
15+
: language) || 'typescript'}
1516
style={darcula}
1617
>
1718
{value}

components/Markdown.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Code from './Code';
44
import { globals } from '../globals';
55

66
export const Markdown: React.FC<{ source: string }> = (props) => {
7-
// console.log(props.source);
87
return (
98
<div style={{ width: '100%' }} className="devii-markdown">
109
<ReactMarkdown

components/Meta.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ export const Meta: React.FC<{
1111
};
1212
}> = (props) => {
1313
const { meta } = props;
14-
// const canonical = `${globals.url}${meta.link}`;
15-
// console.log(canonical);
1614
return (
1715
<NextHead>
1816
<title>{meta.title}</title>
1917
<meta name="copyright" content="Colin McDonnell" />
20-
2118
{meta.link && <link rel="canonical" href={meta.link} />}
2219
{meta.desc && <meta name="description" content={meta.desc} />}
23-
2420
<meta property="og:type" content="website" />
2521
<meta name="og:title" property="og:title" content={meta.title} />
2622
{meta.desc && (
@@ -32,7 +28,6 @@ export const Meta: React.FC<{
3228
)}
3329
<meta property="og:site_name" content={globals.siteName} />
3430
{meta.link && <meta property="og:url" content={`${meta.link}`} />}
35-
3631
<meta name="twitter:card" content="summary" />
3732
<meta name="twitter:title" content={meta.title} />
3833
{meta.desc && <meta name="twitter:description" content={meta.desc} />}

components/PostCard.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,24 @@ export const PostCard: React.FC<{ post: PostData }> = (props) => {
2020
>
2121
<div
2222
style={{
23-
// flexBasis: '300px',
24-
// flex: 1,
25-
// minWidth: '200px',
26-
// maxWidth: '450px',
2723
opacity: 0.92,
2824
boxShadow: '0px 2px 10px #00000040',
2925
width: '100%',
3026
maxWidth: '500px',
3127
overflow: 'hidden',
3228
borderRadius: '8px',
33-
// boxShadow: '0px 2px 10px #00000020',
3429
display: 'flex',
3530
flexDirection: 'column',
3631
height: '100%',
37-
// margin: '10px 0px',
3832
}}
3933
>
4034
{post.thumbnailPhoto && (
4135
<div
4236
style={{
4337
background: `url(${post.thumbnailPhoto}) no-repeat center center`,
4438
backgroundSize: 'cover',
45-
// backgroundImage: post.thumb_image,
46-
// backgroundPosition: 'cover',
4739
width: '100%',
4840
flex: 1,
49-
// height: '200px',
5041
}}
5142
/>
5243
)}
@@ -62,7 +53,6 @@ export const PostCard: React.FC<{ post: PostData }> = (props) => {
6253
<h2
6354
style={{
6455
margin: '0px 0px 7px 0px',
65-
// padding: '2px 0px 2px 0px',
6656
fontSize: '14pt',
6757
fontWeight: 600,
6858
padding: '2px 10%',

components/Tag.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
23
export const Tag: React.FC<{ tag: string }> = (props) => {
34
return (
45
<div

loader.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import matter from 'gray-matter';
22
import glob from 'glob';
33
import { globals } from './globals';
4+
45
export type PostData = {
56
path: string;
67
title: string;
@@ -45,8 +46,12 @@ export const mdToPost = (file: RawFile): PostData => {
4546
content: metadata.content,
4647
};
4748

48-
if (!post.title) throw new Error(`Missing required field: title.`);
49-
if (!post.content) throw new Error(`Missing required field: content.`);
49+
if (!post.title)
50+
throw new Error(`Missing required field: title.`);
51+
52+
if (!post.content)
53+
throw new Error(`Missing required field: content.`);
54+
5055
if (!post.datePublished)
5156
throw new Error(`Missing required field: datePublished.`);
5257

md/blog/the-ultimate-tech-stack.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ published: true
44
datePublished: 1590463136775
55
author: Colin McDonnell
66
authorTwitter: vriad
7-
authorPhoto: https://vriad.com/colin_square_small.jpg
8-
tags:
7+
authorPhoto: /profile.jpg
8+
tags:
99
- Static Site Generators
1010
- React
1111
- Next.js
12-
thumbnailPhoto: https://vriad.com/pancakes_thumb.jpeg
13-
bannerPhoto: https://vriad.com/pancakes.jpeg
12+
thumbnailPhoto: /pancakes_thumb.jpeg
13+
bannerPhoto: /pancakes.jpeg
1414
canonicalUrl: https://vriad.com/essays/devii
1515
---
1616

0 commit comments

Comments
 (0)