forked from tanner/qotnews
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
749 B
28 lines
749 B
<script> |
|
import fromUnixTime from "date-fns/fromUnixTime"; |
|
import formatDistanceToNow from "date-fns/formatDistanceToNow"; |
|
export let story; |
|
|
|
export let dateString = formatDistanceToNow(fromUnixTime(story.date), { |
|
addSuffix: true, |
|
}); |
|
</script> |
|
|
|
<style> |
|
</style> |
|
|
|
<time |
|
datetime={fromUnixTime(story.date).toISOString()} |
|
title={fromUnixTime(story.date)}>{dateString}</time> |
|
{#if story.author && story.author_link} |
|
by |
|
<a href={story.author_link}>{story.author}</a> |
|
{:else if story.author}by {story.author}{/if} |
|
on |
|
<a href={story.url}>{story.source}</a> |
|
{#if story.score}• {story.score} points{/if} |
|
{#if story.num_comments} |
|
• |
|
<a rel="prefetch" href="/{story.id}#comments">{story.num_comments} |
|
comments</a> |
|
{/if}
|
|
|