Skip to content

Commit 2004426

Browse files
k8isdeadborkmann
authored andcommitted
feat: update layout to new design
1 parent 612da44 commit 2004426

File tree

5 files changed

+110
-238
lines changed

5 files changed

+110
-238
lines changed

src/common/blog-post/FeaturedPostCard.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/common/blog-post/PostCard.js

Lines changed: 36 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,60 @@
11
import React from "react";
22
import { format, parseISO } from "date-fns";
3-
import slugify from "slugify";
4-
5-
import parseHtml from "../../../scripts/parse-html";
63

74
const formatPostDate = (post) =>
85
format(parseISO(post.frontmatter.date), "MMMM d, yyyy");
96

10-
const PostCard = ({ post, full }) => {
7+
const PostCard = ({ post }) => {
118
const categories = post.frontmatter.categories || [];
12-
const { hasPreview, previewHtml, mainHtml, previewDescription } =
13-
parseHtml(post);
149

15-
const html = full ? mainHtml : hasPreview ? previewHtml : previewDescription;
1610
const url =
1711
post.frontmatter.externalUrl !== "" ? post.frontmatter.externalUrl : null;
1812

1913
return (
2014
<div className='blog-post-card' key={post.id}>
21-
<a
22-
className='blog-title-link'
23-
href={url || post.frontmatter.path}
24-
target={url ? "_blank" : null}
25-
rel={url ? "noopener noreferrer" : null}
26-
>
27-
<h3 className='blog-title'>{post.frontmatter.title}</h3>
28-
</a>
29-
<div className='blog-post-card-container'>
15+
{post.frontmatter.ogImage && <img className="post-image" src={post.frontmatter.ogImage.publicURL} width="300" height="220"/>}
16+
{!post.frontmatter.ogImage && <img className="post-image" src='/images/placeholder-cover.jpg' width="300" height="220"/>}
17+
<div className="blog-post-card-content">
3018
<a
31-
className='blog-link'
19+
className='blog-title-link'
3220
href={url || post.frontmatter.path}
3321
target={url ? "_blank" : null}
3422
rel={url ? "noopener noreferrer" : null}
3523
>
36-
Read more
37-
<span className='link-triangle' />
24+
<h3 className='blog-title'>{post.frontmatter.title}</h3>
3825
</a>
39-
<div className='blog-categories-and-date'>
40-
<span className='blog-date'>{formatPostDate(post)}</span>
41-
{categories.length > 0 && (
42-
<div className='blog-post-categories'>
43-
{categories.map(
44-
(category, _) =>
45-
category !== "_" && (
46-
<span className='blog-post-category' key={category}>
47-
<a className="blog-post-category-link" href={`/blog/categories/${slugify(category, {lower: true})}`}>
48-
{category}
49-
</a>
50-
</span>
51-
)
52-
)}
53-
{url && (
54-
<span className='blog-post-category blog-post-category-link'>
55-
External
56-
</span>
57-
)}
58-
</div>
59-
)}
26+
<div className='blog-post-card-container'>
27+
<a
28+
className='blog-link'
29+
href={url || post.frontmatter.path}
30+
target={url ? "_blank" : null}
31+
rel={url ? "noopener noreferrer" : null}
32+
>
33+
Read more
34+
<span className='link-triangle' />
35+
</a>
36+
<div className='blog-categories-and-date'>
37+
<span className='blog-date'>{formatPostDate(post)}</span>
38+
{categories.length > 0 && (
39+
<div className='blog-post-categories'>
40+
{categories.map(
41+
(category, _) =>
42+
category !== "_" && (
43+
<span className='blog-post-category' key={category}>
44+
{category}
45+
</span>
46+
)
47+
)}
48+
{url && (
49+
<span className='blog-post-category'>
50+
External
51+
</span>
52+
)}
53+
</div>
54+
)}
55+
</div>
6056
</div>
6157
</div>
62-
<div
63-
className='blog-post-content'
64-
dangerouslySetInnerHTML={{ __html: html }}
65-
/>
6658
</div>
6759
);
6860
};

0 commit comments

Comments
 (0)