---
import DefaultPageLayout from '$/layouts/default.astro'
import MediaPreviewList from '$/components/MediaPreviewList.astro'
import posts from '$/data/astro-media.json'

let title = 'Media from the blog.';
let description = 'A collection of material used or referenced in the posts.'

const allPosts = await posts
const sortedPosts = allPosts.sort((a, b) => new Date(b.date) - new Date(a.date))
---
<DefaultPageLayout content={{ title, description }}>
    <MediaPreviewList posts={sortedPosts} />
</DefaultPageLayout>
