mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
add post dates to title
This commit is contained in:
parent
8840f9d83c
commit
2b60310bdf
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
.hentry__title {
|
.hentry__title {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: $spacer;
|
margin-bottom: $spacer / $line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hentry__title__link {
|
.hentry__title__link {
|
||||||
@ -32,3 +32,10 @@
|
|||||||
margin-top: -($spacer);
|
margin-top: -($spacer);
|
||||||
margin-bottom: $spacer;
|
margin-bottom: $spacer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-style: italic;
|
||||||
|
font-size: $font-size-small;
|
||||||
|
color: $text-color-light;
|
||||||
|
margin-bottom: $spacer / $line-height;
|
||||||
|
}
|
||||||
|
@ -2,17 +2,22 @@ import React, { ReactElement } from 'react'
|
|||||||
import { Link } from 'gatsby'
|
import { Link } from 'gatsby'
|
||||||
import styles from './Title.module.scss'
|
import styles from './Title.module.scss'
|
||||||
import Icon from '../../atoms/Icon'
|
import Icon from '../../atoms/Icon'
|
||||||
|
import Time from '../../atoms/Time'
|
||||||
|
|
||||||
export default function PostTitle({
|
export default function PostTitle({
|
||||||
type,
|
type,
|
||||||
slug,
|
slug,
|
||||||
linkurl,
|
linkurl,
|
||||||
title
|
title,
|
||||||
|
date,
|
||||||
|
updated
|
||||||
}: {
|
}: {
|
||||||
type?: string
|
type?: string
|
||||||
slug?: string
|
slug?: string
|
||||||
linkurl?: string
|
linkurl?: string
|
||||||
title: string
|
title: string
|
||||||
|
date: string
|
||||||
|
updated?: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const linkHostname = linkurl ? new URL(linkurl).hostname : null
|
const linkHostname = linkurl ? new URL(linkurl).hostname : null
|
||||||
|
|
||||||
@ -32,6 +37,14 @@ export default function PostTitle({
|
|||||||
<Link to={slug}>{title}</Link>
|
<Link to={slug}>{title}</Link>
|
||||||
</h1>
|
</h1>
|
||||||
) : (
|
) : (
|
||||||
<h1 className={styles.hentry__title}>{title}</h1>
|
<>
|
||||||
|
<h1 className={styles.hentry__title}>{title}</h1>
|
||||||
|
<div className={styles.time}>
|
||||||
|
{updated && 'published '}
|
||||||
|
<Time date={date} />
|
||||||
|
{updated && ' • updated '}
|
||||||
|
{updated && <Time date={updated} />}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ export default function Post({
|
|||||||
}
|
}
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { post } = data
|
const { post } = data
|
||||||
const { title, image, type, linkurl, style, tags } = post.frontmatter
|
const { title, image, type, linkurl, style, tags, updated } = post.frontmatter
|
||||||
const { slug, githubLink } = post.fields
|
const { slug, githubLink, date } = post.fields
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -40,7 +40,13 @@ export default function Post({
|
|||||||
|
|
||||||
<article className={styles.hentry}>
|
<article className={styles.hentry}>
|
||||||
<header>
|
<header>
|
||||||
<PostTitle type={type} linkurl={linkurl} title={title} />
|
<PostTitle
|
||||||
|
type={type}
|
||||||
|
linkurl={linkurl}
|
||||||
|
title={title}
|
||||||
|
date={date}
|
||||||
|
updated={updated}
|
||||||
|
/>
|
||||||
{type === 'post' && <PostLead post={post} />}
|
{type === 'post' && <PostLead post={post} />}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user