diff --git a/src/components/ArticleGrid/Date.tsx b/src/components/ArticleGrid/Date.tsx index 754e4714..2ad47fe4 100644 --- a/src/components/ArticleGrid/Date.tsx +++ b/src/components/ArticleGrid/Date.tsx @@ -1,14 +1,17 @@ -import * as React from 'react' -import { dateFormat } from '../../lib/date' +import { dateFormat } from 'src/lib/date' -export const Date: React.FC<{ children: string }> = ({ children }) => ( -

+export type DateProps = { + style?: React.CSSProperties + children: string | Date +} +export const Date: React.FC = props => ( +

- {dateFormat(children)} + {dateFormat(props.children)}

) diff --git a/src/components/ArticleGrid/index.tsx b/src/components/ArticleGrid/index.tsx index 2d232085..8e96edaa 100644 --- a/src/components/ArticleGrid/index.tsx +++ b/src/components/ArticleGrid/index.tsx @@ -1,16 +1,18 @@ +import { IArticle } from 'src/types' import { Pager } from '../Pager' import { CardGrid } from '../CardGrid' -import { IArticle } from 'src/types' import { Card, CardLayout } from '../Card' import { Date } from './Date' +import { Block } from '../Block' +import { Spacer } from '../Spacer' -export interface IArticleGridProps { +export type ArticleGridProps = { articles: IArticle[] nextPage: number | null prevPage: number | null } -export const ArticleGrid: React.FC = ({ articles, nextPage, prevPage, ...props }) => ( +export const ArticleGrid: React.FC = ({ articles, nextPage, prevPage, ...props }) => ( <> = ({ articles, nextPage, p const layout: CardLayout = article.featured ? 'featured' : 'simple' const srcSet = article.preview.set.map(({ url, density }) => `${url} ${density}x`).join(' ') + const content = article.featured + ? ( +

+ {article.title} +

+ ) : ( + + {article.title} + + {article.date} + + ) + return ( = ({ articles, nextPage, p gridColumn, }} > -
-

- {article.title} -

- - {/* {article.date} */} -
+ {content}
) })}