forked from tanner/qotnews
29 lines
725 B
Svelte
29 lines
725 B
Svelte
<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
|
|
{story.source}
|
|
{#if story.score}• {story.score} points{/if}
|
|
{#if story.num_comments}
|
|
•
|
|
<a rel="prefetch" href="/{story.id}#comments">{story.num_comments}
|
|
comments</a>
|
|
{/if}
|