Display date on header along with author
This commit is contained in:
parent
65cf7c1b69
commit
5e5319ee3f
2 changed files with 9 additions and 3 deletions
|
@ -4,14 +4,20 @@ export interface Props {
|
|||
author?: {
|
||||
name: string;
|
||||
};
|
||||
date: Date;
|
||||
comp: any;
|
||||
}
|
||||
|
||||
export default function(props: Props) {
|
||||
const dateFormatted = Intl.DateTimeFormat("en-CA", { dateStyle: "long" }).format(props.date);
|
||||
return (
|
||||
<header className="page-header">
|
||||
<h1>{ props.title }</h1>
|
||||
{props.author && <p>By {props.author.name}</p>}
|
||||
{props.author &&
|
||||
<p style={{ color: "var(--color-brown)" }}>
|
||||
By {props.author.name} on <time datetime={props.date.toISOString()}>{dateFormatted}</time>
|
||||
</p>
|
||||
}
|
||||
{props.comp.separator()}
|
||||
<p className="subheading">{ props.description }</p>
|
||||
</header>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default function({ title, description, children, comp, metas, links, author }) {
|
||||
export default function({ title, description, children, comp, metas, links, author, date }) {
|
||||
return (
|
||||
<html lang="en-CA">
|
||||
<head>
|
||||
|
@ -25,7 +25,7 @@ export default function({ title, description, children, comp, metas, links, auth
|
|||
</head>
|
||||
<body>
|
||||
{ comp.navbar() }
|
||||
{ comp.header({title, description, author}) }
|
||||
{ comp.header({title, description, author, date}) }
|
||||
<main>{children}</main>
|
||||
{ comp.footer() }
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue