Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-dynamic-page): backgroundDesign added #7903

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions packages/fiori/src/DynamicPage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
{{/if}}

{{#if actionsInTitle}}
<ui5-dynamic-page-header-actions
?snapped="{{headerSnapped}}"
?pinned="{{headerPinned}}"
@ui5-expand-button-click={{onExpandClick}}
@ui5-pin-button-click={{onPinClick}}
></ui5-dynamic-page-header-actions>
{{> header-actions}}
{{/if}}

</div>
Expand All @@ -22,14 +17,8 @@
{{#if headerInContent}}
<slot name="headerArea"></slot>
{{/if}}

{{#unless actionsInTitle}}
<ui5-dynamic-page-header-actions
?snapped="{{headerSnapped}}"
?pinned="{{headerPinned}}"
@ui5-expand-button-click={{onExpandClick}}
@ui5-pin-button-click={{onPinClick}}
></ui5-dynamic-page-header-actions>
{{> header-actions}}
{{/unless}}

<slot></slot>
Expand All @@ -39,4 +28,13 @@
<div class="{{classes.footer}}">
<slot name="footer"></slot>
</div>
</div>
</div>

{{#*inline "header-actions"}}
<ui5-dynamic-page-header-actions
?snapped="{{headerSnapped}}"
?pinned="{{headerPinned}}"
@ui5-expand-button-click={{onExpandClick}}
@ui5-pin-button-click={{onPinClick}}
></ui5-dynamic-page-header-actions>
{{/inline}}
19 changes: 18 additions & 1 deletion packages/fiori/src/DynamicPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type { Timeout } from "@ui5/webcomponents-base/dist/types.js";
import DynamicPageBackgroundDesign from "./types/DynamicPageBackgroundDesign.js";

// Template
import DynamicPageTemplate from "./generated/templates/DynamicPageTemplate.lit.js";
Expand Down Expand Up @@ -55,6 +56,17 @@ class DynamicPage extends UI5Element {
@property({ type: Boolean })
showFooter!: boolean;

/**
* Indicated the direction in which the Toolbar items will be aligned.
*
* @type {sap.ui.webc.fiori.types.DynamicPageBackgroundDesign}
* @public
* @defaultvalue: "Standard"
* @name sap.ui.webc.fiori.DynamicPage.prototype.BackgroundDesign
*/
@property({ type: DynamicPageBackgroundDesign, defaultValue: DynamicPageBackgroundDesign.Standard })
backgroundDesign!: `${DynamicPageBackgroundDesign}`;

@slot({ "default": true, type: HTMLElement })
content!: HTMLElement[];

Expand All @@ -73,7 +85,8 @@ class DynamicPage extends UI5Element {
showHeaderInStickArea = false;

get classes() {
return {
const backgroundDesignClass = `ui5-dynamic-page-content-background-${this.backgroundDesign.toLowerCase()}`;
const classes = {
root: {
"ui5-dynamic-page-root": true,
},
Expand All @@ -90,6 +103,10 @@ class DynamicPage extends UI5Element {
"ui5-dynamic-page-footer": true,
},
};

classes.content[backgroundDesignClass as keyof typeof classes.content] = true;

return classes;
}

get dynamicPageTitle(): DynamicPageTitle | null {
Expand Down
23 changes: 19 additions & 4 deletions packages/fiori/src/themes/DynamicPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
z-index: 1;
}

.ui5-dynamic-page-content {
padding: 0 0 0 var(--_ui5_dynamic_page_title_content_padding_left);
}

:host {
display: block;
height: 100%;
Expand Down Expand Up @@ -72,4 +68,23 @@
transform: translateY(100%);
opacity: 0;
}
}

/* Dynamic Page Content */


.ui5-dynamic-page-content-background-standard {
background-color: var(--sapBackgroundColor);
}

.ui5-dynamic-page-content-background-solid {
background-color: var(--sapBackgroundColor);
}

.ui5-dynamic-page-content-background-transparent {
background-color: transparent;
}

.ui5-dynamic-page-content-background-list {
background-color: var(--sapGroup_ContentBackground);
}
40 changes: 40 additions & 0 deletions packages/fiori/src/types/DynamicPageBackgroundDesign.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Different types of Dynamic Page background design
*
* @readonly
* @enum {string}
* @public
* @author SAP SE
* @alias sap.ui.webc.fiori.types.DynamicPageBackgroundDesign
*/
enum DynamicPageBackgroundDesign {
/**
* Standard type
* @public
* @type {Standard}
*/
Standard = "Standard",

/**
* Solid type
* @public
* @type {Solid}
*/
Solid = "Solid",

/**
* List type
* @public
* @type {List}
*/
List = "List",

/**
* Transparent type
* @public
* @type {Transparent}
*/
Transparent = "Transparent",
}

export default DynamicPageBackgroundDesign;
2 changes: 1 addition & 1 deletion packages/fiori/test/pages/DynamicPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</head>

<body class="fcl1auto">
<ui5-dynamic-page id="page" show-footer>
<ui5-dynamic-page id="page" show-footer background-design="Solid">
<ui5-dynamic-page-title slot="titleArea">
<ui5-breadcrumbs slot="breadcrumbs">
<ui5-breadcrumbs-item href="https://www.sap.com"
Expand Down