fix: fix widget content collapsing not working

This commit is contained in:
saicaca 2024-02-12 01:10:04 +08:00
parent 8b8a765d56
commit bd17b39fd2
3 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ import ButtonLink from "../control/ButtonLink.astro";
const categories = await getCategoryList();
const COLLAPSED_HEIGHT = "120px";
const COLLAPSED_HEIGHT = "7.5rem";
const COLLAPSE_THRESHOLD = 5;
const isCollapsed = categories.length >= COLLAPSE_THRESHOLD;

View File

@ -8,7 +8,7 @@ import I18nKey from "../../i18n/i18nKey";
const tags = await getTagList();
const COLLAPSED_HEIGHT = "120px";
const COLLAPSED_HEIGHT = "7.5rem";
const isCollapsed = tags.length >= 20;

View File

@ -18,7 +18,7 @@ const {
} = Astro.props
---
<widget-layout data-id={id} data-isCollapsed={isCollapsed} class="pb-4 card-base">
<widget-layout data-id={id} data-is-collapsed={isCollapsed} class="pb-4 card-base">
<div class="font-bold transition text-lg text-neutral-900 dark:text-neutral-100 relative ml-8 mt-4 mb-2
before:w-1 before:h-4 before:rounded-md before:bg-[var(--primary)]
before:absolute before:left-[-16px] before:top-[5.5px]">{name}</div>
@ -45,7 +45,7 @@ const {
constructor() {
super();
if (!this.dataset.isCollapsed)
if (this.dataset.isCollapsed === undefined || this.dataset.isCollapsed === false)
return;
const id = this.dataset.id;