mirror of
https://github.com/KevinMidboe/brewPi.git
synced 2025-10-29 16:50:12 +00:00
New and improved in sveltekit
This commit is contained in:
38
src/routes/brews/+page.svelte
Normal file
38
src/routes/brews/+page.svelte
Normal file
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
export let data;
|
||||
|
||||
const brews = data?.brews || [];
|
||||
const path = (date: string) => '/brews/' + String(date);
|
||||
|
||||
const dateFormat = { year: 'numeric', month: 'short', day: 'numeric' };
|
||||
const dateString = (date) => new Date(date * 1000).toLocaleDateString('no-NB', dateFormat);
|
||||
|
||||
</script>
|
||||
|
||||
<main class="page-content">
|
||||
<h1>Past brews</h1>
|
||||
|
||||
<ul>
|
||||
{#each brews as brew}
|
||||
<li><a href="{path(brew.date)}">{ brew.beer.name } av { brew.beer.brewery }</a> - {dateString(brew.date)}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</main>
|
||||
|
||||
<style lang="scss">
|
||||
main.page-content {
|
||||
|
||||
ul {
|
||||
margin-left: 1.2em;
|
||||
}
|
||||
|
||||
ul li {
|
||||
list-style-type: disc;
|
||||
line-height: 1.5;
|
||||
|
||||
a {
|
||||
color: #19A786;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user