2024-01-17 10:10:44 +00:00
|
|
|
import { Article } from '@/types/content-types'
|
|
|
|
import { Icon } from './Icon'
|
|
|
|
|
2024-05-22 15:55:49 +00:00
|
|
|
interface ArticleDetailsProps {
|
2024-01-17 10:10:44 +00:00
|
|
|
article: Article
|
|
|
|
}
|
|
|
|
|
|
|
|
const ROOT_CONTENT_URL = `https://github.com/tldraw/tldraw/blob/main/apps/docs/content/`
|
|
|
|
|
|
|
|
export function ArticleDetails({ article: { sourceUrl, date } }: ArticleDetailsProps) {
|
|
|
|
return (
|
|
|
|
<div className="article__details">
|
|
|
|
{sourceUrl && (
|
|
|
|
<a className="article__details__edit" href={`${ROOT_CONTENT_URL}${sourceUrl}`}>
|
|
|
|
<Icon icon="edit" />
|
|
|
|
<span>Edit this page</span>
|
|
|
|
</a>
|
|
|
|
)}
|
|
|
|
{date && (
|
|
|
|
<div className="article__details__timestamp">
|
|
|
|
Last edited on{' '}
|
|
|
|
{Intl.DateTimeFormat('en-gb', {
|
|
|
|
year: 'numeric',
|
|
|
|
month: 'long',
|
|
|
|
day: 'numeric',
|
|
|
|
}).format(new Date(date))}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|