Add reviews page with list of revival reviews

This commit is contained in:
Lewin Kelly 2023-07-11 23:54:37 +01:00
parent 8d708d4c4d
commit 9fb9881c74
No known key found for this signature in database
GPG Key ID: C103AD9C84014FD7
3 changed files with 59 additions and 1 deletions

View File

@ -15,7 +15,7 @@
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/revivals">Revival Index</a>
<a href="/revivals">Reviews</a>
<a href="/reviews">Reviews</a>
<a href="/blog">Blog</a>
</nav>
</div>

View File

@ -0,0 +1,31 @@
<script lang="ts">
import when from "$lib/when"
export let data
</script>
<svelte:head>
<title>Reviews • Revival Archive</title>
</svelte:head>
<h1>Reviews</h1>
{#each data.reviews.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) as review}
<a
href="/revival/{review.path}"
class="txt @light:text-dark hover:text-#ccc
@light:hover:text-#555 bg-a rounded-3 durition-500 box-border
block text-white transition hover:shadow-xl">
<article class="mb-4 px-6 py-3">
<h2 class="my-2">{review.name}</h2>
<p class="my-2">
{when(review.date)}
</p>
</article>
</a>
{/each}
<style lang="sass">
a:hover
transform: translateY(-0.15rem)
</style>

View File

@ -0,0 +1,27 @@
export async function load() {
const allPostFiles = import.meta.glob("../../../pages/revivals/*.md")
return {
reviews: Promise.all(
Object.keys(allPostFiles).map(async path => {
const { metadata } = (await allPostFiles[path]()) as any
return {
...(metadata as {
name: string
date: Date
clients: number[]
rating: {
website: number
community: number
clients: number
overall: number
}
overview: string
}),
path: path.match(/(\w+)\.md/)?.[1],
}
})
),
}
}