Skip to content

Commit

Permalink
Add changelog page (#23)
Browse files Browse the repository at this point in the history
* Add changelog page

* Changelog updates

* Add changelog

* Add new api key to example.env

* typo + copy

* Add content to newsletter entry

* improve backlog icon contrast
  • Loading branch information
samuelkraft committed Mar 14, 2021
1 parent 755550e commit 3b6ac85
Show file tree
Hide file tree
Showing 14 changed files with 508 additions and 32 deletions.
1 change: 1 addition & 0 deletions .env.example
Expand Up @@ -5,3 +5,4 @@ SPOTIFY_REFRESH_TOKEN=
CONVERTKIT_FORM_ID=
CONVERTKIT_API_KEY=
NEXT_PUBLIC_GA_TRACKING_ID=
LINEAR_API_KEY=
17 changes: 14 additions & 3 deletions components/page.module.scss
Expand Up @@ -40,13 +40,24 @@

li {
margin-bottom: 0;
color: var(--textTinted);
font-weight: 500;
opacity: 0.5;
transition: opacity 0.2s ease-out;
transition: color 0.2s ease-out;

&:hover,
&:focus {
opacity: 0.8;
color: var(--text);
}
}
}

.badge {
margin-left: 5px;
padding: 2px 5px;
color: white;
font-weight: 500;
font-size: 10px;
text-transform: uppercase;
background-color: var(--brand);
border-radius: 5px;
}
7 changes: 6 additions & 1 deletion components/page.tsx
Expand Up @@ -20,6 +20,7 @@ const footerLinks = [
{ name: 'Percentage change calc', url: '/percentagechange' },
{ name: 'Books', url: '/books' },
{ name: 'Instagram', url: 'https://www.instagram.com/samuelkraft' },
{ name: 'Changelog', url: '/changelog', new: true },
]

const Page = ({ children }: PageProps): JSX.Element => (
Expand All @@ -32,7 +33,11 @@ const Page = ({ children }: PageProps): JSX.Element => (
<ul className={styles.links}>
{footerLinks.map(link => (
<li key={link.name}>
<Link href={link.url}>{link.name}</Link>
<Link href={link.url}>
<a>
{link.name} {link.new && <span className={styles.badge}>New</span>}
</a>
</Link>
</li>
))}
</ul>
Expand Down
6 changes: 6 additions & 0 deletions lib/formatdate.ts
@@ -0,0 +1,6 @@
export const formatDate = (date: string) =>
new Date(date).toLocaleString('en-US', {
month: 'short',
day: '2-digit',
year: 'numeric',
})
14 changes: 14 additions & 0 deletions lib/linear.ts
@@ -0,0 +1,14 @@
import { LinearClient } from '@linear/sdk'

const linearClient = new LinearClient({
apiKey: process.env.LINEAR_API_KEY,
})

export const getAllIssues = async () => {
const issues = await linearClient.issues()

if (issues.nodes.length) {
return issues.nodes
}
return []
}
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -13,6 +13,7 @@
"type-check": "./node_modules/.bin/tsc"
},
"dependencies": {
"@linear/sdk": "^1.8.4",
"@types/gtag.js": "^0.0.4",
"classnames": "^2.2.6",
"faunadb": "^4.1.1",
Expand Down
8 changes: 2 additions & 6 deletions pages/blog.tsx
Expand Up @@ -18,6 +18,7 @@ import Input from 'components/input'

// Utils
import { postFilePaths, POSTS_PATH } from 'utils/mdxutils'
import { formatDate } from 'lib/formatdate'
import * as gtag from 'lib/gtag'

// Types
Expand Down Expand Up @@ -79,11 +80,6 @@ const Blog = ({ posts }: BlogProps): JSX.Element => {
const {
meta: { summary, title, readingTime: readTime, publishedAt, image },
} = post
const formattedDate = new Date(publishedAt).toLocaleString('en-US', {
month: 'short',
day: '2-digit',
year: 'numeric',
})
const slug = post.filePath.replace(/\.mdx?$/, '')
return (
<li key={post.filePath}>
Expand All @@ -99,7 +95,7 @@ const Blog = ({ posts }: BlogProps): JSX.Element => {
</Link>
<p className={styles.summary}>{summary}</p>
<p className={styles.meta}>
Published on <time dateTime={publishedAt}>{formattedDate}</time> &middot; {readTime.text}
Published on <time dateTime={publishedAt}>{formatDate(publishedAt)}</time> &middot; {readTime.text}
</p>
</li>
)
Expand Down
18 changes: 4 additions & 14 deletions pages/blog/[slug].tsx
Expand Up @@ -28,6 +28,8 @@ import AnimatedMessages from 'components/animatedmessages'

// Utils
import { postFilePaths, POSTS_PATH } from 'utils/mdxutils'
import { formatDate } from 'lib/formatdate'

import styles from './post.module.scss'

const CustomLink = (props: { href: string }) => {
Expand Down Expand Up @@ -90,18 +92,6 @@ type PostProps = {
const Post = ({ source }: PostProps): JSX.Element => {
const content = hydrate(source, { components })
const { scope: meta } = source
const formattedPublishDate = new Date(meta.publishedAt).toLocaleString('en-US', {
month: 'short',
day: '2-digit',
year: 'numeric',
})
const formattedUpdatedDate = meta.updatedAt
? new Date(meta.updatedAt).toLocaleString('en-US', {
month: 'short',
day: '2-digit',
year: 'numeric',
})
: null

const seoTitle = `${meta.title} | Samuel Kraft`
const seoDesc = `${meta.summary}`
Expand Down Expand Up @@ -142,8 +132,8 @@ const Post = ({ source }: PostProps): JSX.Element => {
{meta.image && <BlogImage src={meta.image} alt={meta.title} />}
<PageHeader title={meta.title} compact>
<p className={styles.meta}>
Published on <time dateTime={meta.publishedAt}>{formattedPublishDate}</time>
{meta.updatedAt ? ` (Updated ${formattedUpdatedDate})` : ''} <span>&middot;</span> {meta.readingTime.text}
Published on <time dateTime={meta.publishedAt}>{formatDate(meta.publishedAt)}</time>
{meta.updatedAt ? ` (Updated ${formatDate(meta.updatedAt)})` : ''} <span>&middot;</span> {meta.readingTime.text}
<HitCounter slug={meta.slug} />
</p>
</PageHeader>
Expand Down
1 change: 1 addition & 0 deletions pages/books.tsx
Expand Up @@ -9,6 +9,7 @@ import Rating from 'components/rating'
import { ChevronDown } from 'react-feather'
import slugifiy from 'slugify'
import { NextSeo } from 'next-seo'

import styles from './books.module.scss'

const sortOptions = [
Expand Down
10 changes: 3 additions & 7 deletions pages/books/[slug].tsx
Expand Up @@ -11,6 +11,8 @@ import Rating from 'components/rating'
import Page from 'components/page'
import Button from 'components/button'

import { formatDate } from 'lib/formatdate'

import type { Book as BookType } from 'pages/books'

import styles from './book.module.scss'
Expand Down Expand Up @@ -41,12 +43,6 @@ const Book = ({ book, page }: BookProps): JSX.Element => {
}

const { Name: title, Author: author, Rating: rating, Fiction: fiction, Date: date, Link: link, Genres: genres, Image: image } = book
const formattedDate = new Date(date).toLocaleString('en-US', {
month: 'short',
day: '2-digit',
year: 'numeric',
})

const seoTitle = `${title} Book Review - Samuel Kraft`
const seoDesc = `${title} by ${author} book review, notes and thoughts`

Expand Down Expand Up @@ -98,7 +94,7 @@ const Book = ({ book, page }: BookProps): JSX.Element => {
<Rating rating={rating} />
</dd>
<dt>Date finished</dt>
<dd>{formattedDate}</dd>
<dd>{formatDate(date)}</dd>
</dl>
{link && (
<Button href={link} variant="transparent">
Expand Down
208 changes: 208 additions & 0 deletions pages/changelog.module.scss
@@ -0,0 +1,208 @@
.entry {
position: relative;
margin-bottom: 50px;
padding-left: 80px;

&.isDone {
&:before {
position: absolute;
top: 7px;
left: 0;
display: block;
width: 20px;
height: 20px;
border: 4px solid var(--border);
border-radius: 25px;
content: '';
}

&:after {
position: absolute;
top: 27px;
left: 8px;
display: block;
width: 4px;
height: calc(100% + 30px); /* 100% + bottom margin - circle height */
background-color: var(--border);
content: '';
}

&:first-of-type {
&:before {
border-color: var(--brand);
animation: pulse 2s infinite;
}
}

&:last-of-type {
&:after {
display: none;
}
}
}

&.inBacklog {
&:before {
position: absolute;
top: 19px;
left: 20px;
display: block;
width: 21px;
height: 21px;
border: 3px dotted var(--borderActive);
border-radius: 25px;
transition: border-color 150ms ease-out;
content: '';
}

&:hover,
&:focus {
&:before {
border-color: var(--text);
}
}
}

&.inProgress {
&:before {
position: absolute;
top: 19px;
left: 20px;
display: block;
width: 20px;
height: 20px;
border: 4px solid #ecc962;
border-radius: 25px;
content: '';
}

&:after {
position: absolute;
top: 25px;
left: 30px;
display: block;
width: 4px;
height: 8px;
background-color: #ecc962;
border-top-right-radius: 25px;
border-bottom-right-radius: 25px;
content: '';
}
}

&.inBacklog,
&.inProgress {
margin: -15px -20px 20px;
padding-top: 15px;
padding-right: 20px;
padding-bottom: 15px;
padding-left: 80px;
transition: background-color 250 ms ease-out;

.title {
margin-bottom: 7px;
font-size: 22px;
}

&:hover,
&:focus {
background-color: var(--boxBg);
border-radius: 10px;
}
}

&:last-of-type {
.content {
border: none;
}
}
}

.section {
margin-bottom: 60px;
}

@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(227, 131, 86, 0.4);
}
70% {
box-shadow: 0 0 0 10px rgba(227, 131, 86, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(227, 131, 86, 0);
}
}

.title {
margin-bottom: 8px;
font-size: 25px;
}

.meta {
display: flex;
font-size: 14px;
font-family: Menlo, Monaco, 'Lucida Console', 'Courier New', Courier, monospace;
opacity: 0.7;

a:hover,
a:focus {
text-decoration: underline;
}
}

.date {
margin-bottom: 0;
}

.separator {
margin-right: 7px;
margin-left: 7px;
}

.image {
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
border: 1px solid var(--border);
border-radius: 10px;
}

.content {
padding-top: 10px;
padding-bottom: 30px;
font-size: 18px;
line-height: 1.65;
border-bottom: 1px solid var(--border);

a {
color: var(--brand);

&:hover,
&:focus {
text-decoration: underline;
}
}

ul {
padding-left: 27px;
}

li {
position: relative;
margin-bottom: 4px;
list-style-type: none;

&:before {
position: absolute;
top: 15px;
left: -27px;
display: block;
width: 12px;
height: 1px;
background-color: var(--brand);
content: '';
}
}
}

1 comment on commit 3b6ac85

@vercel
Copy link

@vercel vercel bot commented on 3b6ac85 Mar 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.