0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-29 16:36:44 +01:00
svelte/site/content/examples/hacker-news/Summary.html
2018-12-22 16:09:27 -05:00

38 lines
628 B
HTML

<script>
export let item;
export let i;
export let offset;
function comment_text() {
const c = item.comments_count;
return `${c} ${c === 1 ? 'comment' : 'comments'}`;
}
</script>
<style>
article {
position: relative;
padding: 0 0 0 2em;
border-bottom: 1px solid #eee;
}
h2 {
font-size: 1em;
margin: 0.5em 0;
}
span {
position: absolute;
left: 0;
}
a {
color: #333;
}
</style>
<article>
<span>{i + offset + 1}</span>
<h2><a target="_blank" href={item.url}>{item.title}</a></h2>
<p class="meta"><a href="#/item/{item.id}">{comment_text()}</a> by {item.user} {item.time_ago}</p>
</article>