forked from tnonate/thenewoil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuidesList.astro
31 lines (28 loc) · 930 Bytes
/
GuidesList.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
import type { MDXInstance } from "astro";
interface GuidePageFrontMatter {
weight: number;
topic: number;
}
const allPages = (await Astro.glob("../../pages/*/guides/*/*")) as MDXInstance<GuidePageFrontMatter>[];
const pages = allPages
.filter((page) => page.url?.includes(Astro.url.pathname))
.sort((a, b) => a.frontmatter.weight - b.frontmatter.weight);
---
<ul class="grid grid-cols-1 gap-8 px-0 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4">
{
pages.map(
(page) =>
page.frontmatter.topic && (
<li class="w-full list-none">
<a
class="flex h-40 w-full items-center justify-center rounded-lg border-4 border-solid p-4 text-center font-semibold border-gradient-secondary border-bg-primary dark:border-bg-primary-dark"
href={page.url}
>
{page.frontmatter.topic}
</a>
</li>
)
)
}
</ul>