Skip to content

Commit 8ff839f

Browse files
committed
refactor(collapse): update closeHeight logic
Adjust the logic for setting closeHeight to prioritize dataset values over options. Update import paths to reference the correct collapsible module. These changes improve code clarity and ensure consistent behavior.
1 parent 8f1a2dd commit 8ff839f

File tree

6 files changed

+19
-34
lines changed

6 files changed

+19
-34
lines changed

docs/package-lock.json

Lines changed: 12 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@astrojs/preact": "^4.0.2",
2121
"@astrojs/vercel": "^8.0.2",
2222
"@astrojs/vue": "^5.0.5",
23-
"@flexilla/flexilla": "^2.1.4",
23+
"@flexilla/flexilla": "^2.1.5",
2424
"@flexilla/utilities": "^2.0.71",
2525
"@fontsource/geist-sans": "^5.1.0",
2626
"@preact/signals": "^1.2.2",

docs/src/assets/js/doc-script.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { Tabs, Collapse, Dismissible, Popover, Dropdown, Tooltip, Modal, OffCanvas, AutoResizeTextArea } from "@flexilla/flexilla";
1+
import { Tabs, Collapse, Dismissible, Popover, Dropdown, Accordion, Tooltip, Modal, OffCanvas, AutoResizeTextArea } from "@flexilla/flexilla";
22
import { $, $$ } from "@flexilla/utilities";
33

4-
import { Accordion } from "./../../../../packages/accordion/src/index"
5-
64

75
const initTableOfContent = () => {
86
const tabOfContentMob = $("[data-tabs-content]");

docs/src/layouts/BaseLayout.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import SEO from "./SEO.astro";
33
import { type SeoType } from "@/types/index";
44
import "@assets/css/global.css";
5-
import { ViewTransitions } from "astro:transitions";
5+
import { ClientRouter } from "astro:transitions";
66
interface Props {
77
seo: SeoType;
88
}
@@ -17,7 +17,7 @@ const { seo } = Astro.props;
1717
<link rel="sitemap" href="/sitemap-index.xml" />
1818
</SEO>
1919

20-
<ViewTransitions />
20+
<ClientRouter />
2121
<script is:inline>
2222
const initTheme = () => {
2323
const docEl = document.documentElement;

docs/src/pages/docs/[...slug].astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
---
2-
export const prerender = true;
3-
42
import { sidebarItemFlaterned } from "@helper/doc-helper";
53
import { getCollection } from "astro:content";
64

packages/collapse/src/collapse.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { CollapseOptions } from "./types";
33

44
import { $$, $, dispatchCustomEvent } from "@flexilla/utilities"
5-
import { expandElement, collapseElement, initCollapsible } from "./../../collapsible"
5+
import { expandElement, collapseElement, initCollapsible } from "./../../collapsible/src/collapsible"
66
import {FlexillaManager} from "@flexilla/manager"
77

88
/**
@@ -65,7 +65,7 @@ class Collapse {
6565

6666
this.options = options
6767
this.defaultState = this.element.dataset.state ? (this.element.dataset.state === "open" ? "open" : "close") : this.options.defaultState || "close"
68-
this.closeHeight = this.options.closeHeight || parseInt(this.element.dataset.closeHeight || "0") || 0
68+
this.closeHeight = this.element.dataset.closeHeight ? parseInt(this.element.dataset.closeHeight || "0") : this.options.closeHeight || 0
6969
this.initCollapse()
7070
FlexillaManager.register('collapse', this.element, this)
7171
}
@@ -133,7 +133,7 @@ class Collapse {
133133
this.collapseTrigger.addEventListener("click", this.toggle)
134134
this.collapseTrigger.ariaExpanded = this.defaultState === "open" ? "true" : "false"
135135
}
136-
initCollapsible(this.element, this.defaultState, `${this.closeHeight}`)
136+
initCollapsible(this.element, this.defaultState, `${this.closeHeight}px`)
137137
}
138138

139139
/**

0 commit comments

Comments
 (0)