-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/@lekoarts/gatsby-theme-minimal-blog/components/blog-list-item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** @jsx jsx */ | ||
import * as React from "react" | ||
import { Text } from "theme-ui" | ||
import { jsx, Box } from "theme-ui" | ||
import { Link } from "gatsby" | ||
import ItemTags from "./item-tags" | ||
import { Highlight } from "../utils" | ||
|
||
/** | ||
* Shadowed component with the following tweaks: | ||
* - Support pinning posts | ||
*/ | ||
|
||
type BlogListItemProps = { | ||
post: { | ||
slug: string | ||
title: string | ||
date: string | ||
excerpt: string | ||
description: string | ||
timeToRead?: number | ||
tags?: { | ||
name: string | ||
slug: string | ||
}[] | ||
} | ||
featured?: boolean | ||
showTags?: boolean | ||
} | ||
|
||
const BlogListItem = ({ featured, post, showTags = true }: BlogListItemProps) => ( | ||
<Box mb={4}> | ||
<Link to={post.slug} sx={(t) => ({ ...t.styles?.a, fontSize: [1, 2, 3], color: `text` })}> | ||
{ featured ? <Highlight>📌 {post.title}</Highlight> : post.title } | ||
</Link> | ||
<p sx={{ color: `secondary`, mt: 1, a: { color: `secondary` }, fontSize: [1, 1, 2] }}> | ||
<time>{post.date}</time> | ||
{post.tags && showTags && ( | ||
<React.Fragment> | ||
{` — `} | ||
<ItemTags tags={post.tags} /> | ||
</React.Fragment> | ||
)} | ||
</p> | ||
</Box> | ||
) | ||
|
||
export default BlogListItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** @jsx jsx */ | ||
import { jsx } from 'theme-ui' | ||
import { ReactNode } from 'react' | ||
|
||
export const Highlight = ({ children }: { children: ReactNode }) => { | ||
return <strong style={{ color: 'rgb(255, 146, 112)' }}>{children}</strong> | ||
} |