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.
svelte/documentation/examples/21-miscellaneous/01-hacker-news/Item.svelte

44 lines
652 B

<script>
import Comment from './Comment.svelte';
export let item;
export let returnTo;
$: url = !item.domain ? `https://news.ycombinator.com/${item.url}` : item.url;
</script>
<a href={returnTo}>&laquo; back</a>
<article>
<a href={url}>
<h1>{item.title}</h1>
{#if item.domain}
<small>{item.domain}</small>
{/if}
</a>
<p class="meta">submitted by {item.user} {item.time_ago}</p>
</article>
<div class="comments">
{#each item.comments as comment}
<Comment {comment} />
{/each}
</div>
<style>
article {
margin: 0 0 1em 0;
}
a {
display: block;
margin: 0 0 1em 0;
}
h1 {
font-size: 1.4em;
margin: 0;
}
</style>