import React from "react" import cx from "classnames" import { HeaderBarebone } from "../HeaderBarebone" import { Breadcrumb } from "../Breadcrumb" import { StackedAvatars } from "../StackedAvatars" import * as SC from "./styles" interface IHeaderProps { relativePath: string basePath: string title: string authors?: { avatar: string hash: string name: string }[] createdAt: string timeToRead: number shifted: boolean } export const Header: React.FC = ({ basePath, relativePath, title, authors, createdAt, timeToRead, shifted, }) => { const date = new Date(createdAt) const month = date.toLocaleString("default", { month: "long" }) const day = date.getDate() const year = date.getUTCFullYear() const dateToHuman = `${month} ${day}, ${year}` return ( } title={title} className={cx({ shifted })} content={ {authors && ( {authors.length > 1 ? ( {authors.length} contributor{authors.length > 1 && "s"} {authors .map((author) => `${author.name}#${author.hash}`) .join(", ")} ) : ( `${authors[0].name}#${authors[0].hash}` )} )} {dateToHuman && {dateToHuman}} {timeToRead} minute{timeToRead !== 1 && "s"} read time } /> ) }