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

export async function getStaticPaths() {
    const materie = import.meta.glob('../../content/appunti/*.md')

    return await Promise.all(
        Object.keys(materie).map(async filename => {
            // @ts-ignore
            const { Content, frontmatter, file } = await materie[filename]()

            return {
                params: {
                    materia: file.replace(/\.md$/, '').split('/').pop(),
                },
                props: {
                    frontmatter,
                    Content,
                },
            }
        })
    )
}

const { Content, frontmatter } = Astro.props
---

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

    <h1>
        {frontmatter.title}
        <img src="/~misuraca/libri.png" alt="libri" />
    </h1>
    <div class="text">
        <Content />
    </div>
</Base>
