feat: allow collapsing widget content, add categories widget

(cherry picked from commit 9a4ca8f6163d5e1375aa7c612e1338cce5a8c0b5)
This commit is contained in:
saicaca committed 2023-10-18 02:15:28 +08:00
1 parent 83b765a398
commit f4dc88e982
16 files changed
+174 -33

No files matched your search

@@ -0,0 +1,21 @@
---
import {CategoryMap} from "../../utils/content-utils";
import {getCategoryUrl} from "../../utils/url-utils";
import ButtonLink from "../control/ButtonLink.astro";
interface Props {
categories: CategoryMap;
}
const {categories} = Astro.props;
---
<div>
{Object.entries(categories).map(([key, value]) =>
<ButtonLink url={getCategoryUrl(key)} badge={value.count}>{value.name}</ButtonLink>
<div class="ml-2">
{Object.keys(value.children).length > 0 && <Astro.self categories={value.children}></Astro.self>}
</div>
)}
</div>