Skip to content

Commit 10b502a

Browse files
committed
applayout - hopefully improved banner handling
1 parent 4c6257b commit 10b502a

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

library/src/layouting/AppLayout.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export function initTopNavigationHeight() {
2929
}
3030
const topNavHeight = topNav[0].clientHeight
3131
if (topNavHeight) {
32+
console.info("UIKitTs - Top navigation height set to:", topNavHeight)
3233
document.documentElement.style.setProperty(
3334
topNavigationHeightVar,
3435
`${topNavHeight}px`,
@@ -40,6 +41,7 @@ export function initTopNavigationHeight() {
4041
const header = headers.item(i)
4142
if (header?.getAttribute("role") === "banner") {
4243
const bannerHeight = header.clientHeight || 0
44+
console.info("UIKitTs - Banner height set to:", bannerHeight)
4345
document.documentElement.style.setProperty(
4446
bannerHeightVar,
4547
`${bannerHeight}px`,
@@ -54,7 +56,7 @@ export function initTopNavigationHeight() {
5456

5557
if (!uikts_layouting_heightCB) {
5658
window.addEventListener("resize", initTopNavigationHeight)
57-
console.info("Added resize event listener for App layouting")
59+
console.info("UIKitTs - Added resize event listener for App layouting")
5860
uikts_layouting_heightCB = true
5961
}
6062
}
@@ -68,11 +70,13 @@ function Container({
6870
className,
6971
style,
7072
testId,
73+
useBanner = false,
7174
}: {
7275
children: React.ReactNode
7376
className?: string
7477
style?: React.CSSProperties
7578
testId?: string
79+
useBanner?: boolean
7680
}) {
7781
return (
7882
<div
@@ -83,15 +87,24 @@ function Container({
8387
data-layout-container="true"
8488
data-testid={testId}
8589
style={{
86-
gridTemplateAreas: `
90+
gridTemplateAreas: useBanner
91+
? `
8792
"left-panel banner right-panel"
8893
"left-panel top-navigation right-panel"
8994
"left-panel content right-panel"
95+
`
96+
: `
97+
"left-panel top-navigation right-panel"
98+
"left-panel content right-panel"
9099
`,
91100
gridTemplateColumns: `var(${leftPanelWidthVar}, 0px) minmax(0, 1fr) var(${rightPanelWidthVar}, 0px)`,
92-
gridTemplateRows: `var(${topNavigationHeightVar}, min-content) 1fr`,
101+
gridTemplateRows: useBanner
102+
? `var(${bannerHeightVar}, 0) var(${topNavigationHeightVar}, min-content) 1fr`
103+
: `var(${topNavigationHeightVar}, min-content) 1fr`,
93104
outline: "none",
94-
height: `calc(100dvh - var(${bannerHeightVar}, 0px))`,
105+
height: useBanner
106+
? "100dvh"
107+
: `calc(100dvh - var(${bannerHeightVar}, 0px))`,
95108
...style,
96109
}}
97110
>

showcase/public/showcase-sources.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ export default function AnimatedListShowcase(props: ShowcaseProps) {
196196
)
197197
}
198198

199-
import React from "react"
200199
import ShowcaseWrapperItem, {
201200
type ShowcaseProps,
202201
} from "../../ShowCaseWrapperItem/ShowcaseWrapperItem"
@@ -220,7 +219,7 @@ export default function AppLayoutShowcase(props: ShowcaseProps) {
220219
packages={[
221220
{
222221
name: "@linked-planet/ui-kit-ts",
223-
url: "https://linked-planet.github.io/ui-kit-ts/applayoutexample/index.html",
222+
url: "/ui-kit-ts/applayoutexample/index.html",
224223
},
225224
]}
226225
examples={[
@@ -8335,6 +8334,7 @@ function Example() {
83358334
requestMoreEntriesCB()
83368335
requestMoreEntriesCB()
83378336
requestMoreEntriesCB()
8337+
/*requestMoreEntriesCB()
83388338
requestMoreEntriesCB()
83398339
requestMoreEntriesCB()
83408340
requestMoreEntriesCB()
@@ -8352,8 +8352,7 @@ function Example() {
83528352
requestMoreEntriesCB()
83538353
requestMoreEntriesCB()
83548354
requestMoreEntriesCB()
8355-
requestMoreEntriesCB()
8356-
requestMoreEntriesCB()
8355+
requestMoreEntriesCB()*/
83578356
}, [requestMoreEntriesCB])
83588357

83598358
return (

showcase/src/components/showcase/wrapper/AppLayoutShowcase.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react"
21
import ShowcaseWrapperItem, {
32
type ShowcaseProps,
43
} from "../../ShowCaseWrapperItem/ShowcaseWrapperItem"
@@ -22,7 +21,7 @@ export default function AppLayoutShowcase(props: ShowcaseProps) {
2221
packages={[
2322
{
2423
name: "@linked-planet/ui-kit-ts",
25-
url: "https://linked-planet.github.io/ui-kit-ts/applayoutexample/index.html",
24+
url: "/ui-kit-ts/applayoutexample/index.html",
2625
},
2726
]}
2827
examples={[

0 commit comments

Comments
 (0)