0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/site/content/examples/20-miscellaneous/01-hacker-news/Item.svelte

43 lines
613 B
Svelte
Raw Normal View History

<script>
import Comment from "./Comment.html";
export let item;
function back(event) {
event.preventDefault();
window.history.back();
}
</script>
<style>
article {
margin: 0 0 1em 0;
}
a {
display: block;
margin: 0 0 1em 0;
}
h1 {
font-size: 1.4em;
margin: 0;
}
</style>
<a href="#/top/1" on:click={back}>&laquo; back</a>
<article>
<a href="{item.url}">
<h1>{item.title}</h1>
<small>{item.domain}</small>
</a>
<p class="meta">submitted by {item.user} {item.time_ago}
</article>
<div class="comments">
{#each item.comments as comment}
<Comment {comment}/>
{/each}
</div>