Skip to content

Commit

Permalink
feat(ui5-dynamic-page): fit content that has 100% height
Browse files Browse the repository at this point in the history
  • Loading branch information
kineticjs committed Dec 5, 2023
1 parent 9670fab commit ecb78a1
Show file tree
Hide file tree
Showing 6 changed files with 571 additions and 8 deletions.
7 changes: 6 additions & 1 deletion packages/fiori/src/DynamicPage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
{{/unless}}

<div class="{{classes.content}}">
<slot></slot>
<div class="{{classes.fitContent}}">
<slot></slot>
{{#if showFooter}}
<div class="{{classes.spacer}}"></div>
{{/if}}
</div>
</div>
</div>

Expand Down
6 changes: 6 additions & 0 deletions packages/fiori/src/DynamicPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@ class DynamicPage extends UI5Element {
content: {
"ui5-dynamic-page-content": true,
},
fitContent: {
"ui5-dynamic-page-fit-content": true,
},
footer: {
"ui5-dynamic-page-footer": true,
},
spacer: {
"ui5-dynamic-page-spacer": true,
},
};
}

Expand Down
37 changes: 30 additions & 7 deletions packages/fiori/src/themes/DynamicPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,29 @@
}

.ui5-dynamic-page-scroll-container {
overflow-y: scroll;
overflow-y: auto;
height: 100%;
}

/* Automatically fit content that has height: 100% */
.ui5-dynamic-page-scroll-container {
display: flex;
flex-direction: column;
}

.ui5-dynamic-page-content {
flex-grow: 1;
position: relative;
}

.ui5-dynamic-page-fit-content {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}

/* Footer */
.ui5-dynamic-page-footer {
position: sticky;
Expand All @@ -32,8 +51,12 @@
opacity: 1;
}

:host([show-footer]) .ui5-dynamic-page-content {
padding-bottom: 4rem;
.ui5-dynamic-page-spacer {
height: var(--_ui5_dynamic_page_footer_spacer);
}

:host([show-footer]) .ui5-dynamic-page-fit-content {
bottom: var(--_ui5_dynamic_page_footer_spacer);
}

:host([show-footer]) .ui5-dynamic-page-footer {
Expand Down Expand Up @@ -82,7 +105,7 @@

/* Responsive paddings */

:host([media-range="S"]) .ui5-dynamic-page-content,
:host([media-range="S"]) .ui5-dynamic-page-fit-content,
:host([media-range="S"]) ::slotted([slot="titleArea"]),
:host([media-range="S"]) ::slotted([slot="headerArea"]) {
padding: 0 1rem;
Expand All @@ -92,16 +115,16 @@
padding-top: 0.5rem;
}

:host([media-range="M"]) .ui5-dynamic-page-content,
:host([media-range="M"]) .ui5-dynamic-page-fit-content,
:host([media-range="M"]) ::slotted([slot="titleArea"]),
:host([media-range="M"]) ::slotted([slot="headerArea"]),
:host([media-range="L"]) .ui5-dynamic-page-content,
:host([media-range="L"]) .ui5-dynamic-page-fit-content,
:host([media-range="L"]) ::slotted([slot="titleArea"]),
:host([media-range="L"]) ::slotted([slot="headerArea"]) {
padding: 0 2rem;
}

:host([media-range="XL"]) .ui5-dynamic-page-content,
:host([media-range="XL"]) .ui5-dynamic-page-fit-content,
:host([media-range="XL"]) ::slotted([slot="titleArea"]),
:host([media-range="XL"]) ::slotted([slot="headerArea"]) {
padding: 0 3rem;
Expand Down
1 change: 1 addition & 0 deletions packages/fiori/src/themes/base/DynamicPage-parameters.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:root {
--_ui5_dynamic_page_title_content_padding_left: 1rem;
--_ui5_dynamic_page_footer_spacer: 4rem;
}
Loading

0 comments on commit ecb78a1

Please sign in to comment.