Skip to content

Commit 3afc481

Browse files
Merge pull request #69 from linked-planet/dev
Dev
2 parents d7f32cf + 00529a7 commit 3afc481

File tree

4 files changed

+325
-255
lines changed

4 files changed

+325
-255
lines changed

library/src/layouting/AppLayout.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export const topNavigationHeightVar = "--topNavigationHeight" as const
1414
export const leftPanelWidthVar = "--leftPanelWidth" as const
1515
export const rightPanelWidthVar = "--rightPanelWidth" as const
1616

17+
let uikts_layouting_heightCB = false
18+
/**
19+
* Initialize the top navigation height variable by setting it to the height of the top navigation element.
20+
*/
1721
export function initTopNavigationHeight() {
1822
const topNav = document.getElementsByClassName("aui-header")
1923
if (!topNav.length) {
@@ -30,6 +34,29 @@ export function initTopNavigationHeight() {
3034
`${topNavHeight}px`,
3135
)
3236
}
37+
38+
const headers = document.getElementsByTagName("header")
39+
for (let i = 0; i < headers.length; i++) {
40+
const header = headers.item(i)
41+
if (header?.getAttribute("role") === "banner") {
42+
const bannerHeight = header.clientHeight || 0
43+
document.documentElement.style.setProperty(
44+
bannerHeightVar,
45+
`${bannerHeight}px`,
46+
)
47+
console.log(
48+
"UIKitTs - Banner height set to:",
49+
bannerHeight,
50+
header.clientHeight,
51+
)
52+
}
53+
}
54+
55+
if (!uikts_layouting_heightCB) {
56+
window.addEventListener("resize", initTopNavigationHeight)
57+
console.info("Added resize event listener for App layouting")
58+
uikts_layouting_heightCB = true
59+
}
3360
}
3461

3562
/**
@@ -62,8 +89,9 @@ function Container({
6289
"left-panel content right-panel"
6390
`,
6491
gridTemplateColumns: `var(${leftPanelWidthVar}, 0px) minmax(0, 1fr) var(${rightPanelWidthVar}, 0px)`,
65-
gridTemplateRows: `var(${bannerHeightVar}, min-content) var(${topNavigationHeightVar}, min-content) 1fr`,
92+
gridTemplateRows: `var(${topNavigationHeightVar}, min-content) 1fr`,
6693
outline: "none",
94+
height: `calc(100dvh - var(${bannerHeightVar}, 0px))`,
6795
...style,
6896
}}
6997
>

0 commit comments

Comments
 (0)