---
import Base from '../layouts/Base.astro'

const materie = import.meta.glob('../content/appunti/*.md')

const materieSlugTitle = await Promise.all(
    Object.values(materie).map(async materiaModule => {
        // @ts-ignore
        const { file, frontmatter } = await materiaModule()

        const slug = file.match(/appunti\/(.*).md$/)[1]
        return { title: frontmatter.title, slug }
    })
)
---

<Base>
    <img slot="sidebar-bottom" src="/~misuraca/pi-greco.png" alt="pi greco" />

    <h1>
        Appunti

        <img src="/~misuraca/libri.png" alt="libri" />
    </h1>
    <div class="text">
        {
            materieSlugTitle.map(({ title, slug }) => (
                <a href={`/~misuraca/appunti/${slug}/`}>
                    <h2>{title}</h2>
                </a>
            ))
        }
    </div>
</Base>
