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?: {
|
author?: {
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
date: Date;
|
||||||
comp: any;
|
comp: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(props: Props) {
|
export default function(props: Props) {
|
||||||
|
const dateFormatted = Intl.DateTimeFormat("en-CA", { dateStyle: "long" }).format(props.date);
|
||||||
return (
|
return (
|
||||||
<header className="page-header">
|
<header className="page-header">
|
||||||
<h1>{ props.title }</h1>
|
<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()}
|
{props.comp.separator()}
|
||||||
<p className="subheading">{ props.description }</p>
|
<p className="subheading">{ props.description }</p>
|
||||||
</header>
|
</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 (
|
return (
|
||||||
<html lang="en-CA">
|
<html lang="en-CA">
|
||||||
<head>
|
<head>
|
||||||
|
@ -25,7 +25,7 @@ export default function({ title, description, children, comp, metas, links, auth
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{ comp.navbar() }
|
{ comp.navbar() }
|
||||||
{ comp.header({title, description, author}) }
|
{ comp.header({title, description, author, date}) }
|
||||||
<main>{children}</main>
|
<main>{children}</main>
|
||||||
{ comp.footer() }
|
{ comp.footer() }
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue