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-navigation-layout): add ui5-navigation-layout component #9517

Merged
merged 32 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5b0768b
WIP(ui5-tool-page): add ui5-tool-page component
TeodorTaushanov Jul 18, 2024
dc90dc0
chore: fix styles
TeodorTaushanov Jul 18, 2024
fe43552
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Jul 19, 2024
9cf2882
chore: reorganize code
TeodorTaushanov Jul 19, 2024
9524b94
chore: rename to ui5-navigation-layout
TeodorTaushanov Jul 19, 2024
57ccd0a
fix: fix mobile aside z-index
TeodorTaushanov Jul 19, 2024
319352f
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Jul 19, 2024
b6c1a5d
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Jul 24, 2024
ae7849e
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Jul 29, 2024
79e3b60
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 16, 2024
9f0f72d
chore: adapt styles according to the new design
TeodorTaushanov Oct 16, 2024
ee723b8
chore: fix comments
TeodorTaushanov Oct 16, 2024
5c70243
chore: fix lint error
TeodorTaushanov Oct 16, 2024
e97b8f3
chore: docs and example
TeodorTaushanov Oct 16, 2024
d7b2390
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 17, 2024
90b212b
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 18, 2024
9cdff67
chore: update example
TeodorTaushanov Oct 18, 2024
4b5d67c
chore: improve layout and sample
TeodorTaushanov Oct 18, 2024
15dc805
chore: improve sample
TeodorTaushanov Oct 18, 2024
a973847
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 21, 2024
55e97e5
chore: add tests
TeodorTaushanov Oct 21, 2024
0bd0ece
chore: improve sample
TeodorTaushanov Oct 21, 2024
5993fa0
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 21, 2024
3580e35
chore: remove unnecessary code
TeodorTaushanov Oct 21, 2024
5bbb2b4
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 23, 2024
ccf9e53
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 23, 2024
09401fd
chore: improve styles
TeodorTaushanov Oct 23, 2024
9498988
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 29, 2024
f63b3c3
chore: address code review comments
TeodorTaushanov Oct 29, 2024
3699c29
chore: improve the public example
TeodorTaushanov Oct 29, 2024
02b9119
Merge remote-tracking branch 'origin/main' into tool_page
TeodorTaushanov Oct 30, 2024
9228886
chore: fix internal sample
TeodorTaushanov Oct 30, 2024
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
14 changes: 14 additions & 0 deletions packages/fiori/src/NavigationLayout.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="ui5-nl-root">
<header
class="ui5-nl-header">
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
<slot name="header"></slot>
</header>
<section class="ui5-nl-section">
<aside class="ui5-nl-aside">
<slot name="sideContent"></slot>
</aside>
<div class="ui5-nl-content">
<slot></slot>
</div>
</section>
</div>
106 changes: 106 additions & 0 deletions packages/fiori/src/NavigationLayout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
import browserScrollbarCSS from "@ui5/webcomponents/dist/generated/themes/BrowserScrollbar.css.js";
import {
isPhone,
isTablet,
isCombi,
} from "@ui5/webcomponents-base/dist/Device.js";
import type SideNavigation from "./SideNavigation.js";

// Template
import NavigationLayoutTemplate from "./generated/templates/NavigationLayoutTemplate.lit.js";

// Styles
import NavigationLayoutCss from "./generated/themes/NavigationLayout.css.js";

/**
* @class
*
* ### Overview
*
* The `ui5-tool-page` is a container ...
* ### ES6 Module Import
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
*
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
* `import "@ui5/webcomponents-fiori/dist/NavigationLayout.js";`
* @constructor
* @extends UI5Element
* @since 2.1.0
* @public
*/
@customElement({
tag: "ui5-navigation-layout",
languageAware: true,
renderer: litRender,
styles: [
browserScrollbarCSS,
NavigationLayoutCss,
],
template: NavigationLayoutTemplate,
})
class NavigationLayout extends UI5Element {
_sideCollapsed = isPhone() || (isTablet() && !isCombi());

/**
* @private
*/
@property({ type: Boolean })
isPhone = isPhone();

/**
* @private
*/
@property({ type: Boolean })
isTablet = isTablet() && !isCombi();

/**
* Indicates whether if the side menu is collapsed.
* @public
*/
@property({ type: Boolean })
set sideCollapsed(value: boolean) {
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
this._sideCollapsed = value;

if (isPhone()) {
return;
}

const sideNavigation = this.querySelector("[ui5-side-navigation]") as SideNavigation;

if (sideNavigation) {
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
sideNavigation.collapsed = value;
}
}

get sideCollapsed() {
return this._sideCollapsed;
}

/**
* Defines the header HTML Element.
* @public
*/
@slot()
header!: Array<HTMLElement>;

/**
* Defines the side content HTML Element.
* @public
*/
@slot()
sideContent!: Array<HTMLElement>;

/**
* Defines the content HTML Element.
* @public
*/
@slot({ type: HTMLElement, "default": true })
content!: Array<HTMLElement>;
}

NavigationLayout.define();

export default NavigationLayout;
2 changes: 1 addition & 1 deletion packages/fiori/src/SideNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class SideNavigation extends UI5Element {
* @private
*/
@property({ type: Boolean })
isTouchDevice = false;;
isTouchDevice = false;

static i18nBundle: I18nBundle;

Expand Down
1 change: 1 addition & 0 deletions packages/fiori/src/bundle.esm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import SideNavigationItem from "./SideNavigationItem.js";
import SideNavigationSubItem from "./SideNavigationSubItem.js";
import SortItem from "./SortItem.js";
import Timeline from "./Timeline.js";
import NavigationLayout from "./NavigationLayout.js";
import UploadCollection from "./UploadCollection.js";
import UploadCollectionItem from "./UploadCollectionItem.js";
import ViewSettingsDialog from "./ViewSettingsDialog.js";
Expand Down
90 changes: 90 additions & 0 deletions packages/fiori/src/themes/NavigationLayout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

:host(:not([hidden])) {
width: 100%;
height: 100%;
display: block;
padding: 0.5rem 0.5rem 0 0.5rem;
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
background: var(--sapBackgroundColor);
box-sizing: border-box;
overflow: hidden;
}

:host(:not([hidden][is-tablet])) {
padding: 0.5rem;
}

:host(:not([hidden][is-phone])) {
padding: 0.25rem;
}

.ui5-nl-root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
}

.ui5-nl-header {

}

.ui5-nl-section {
display: flex;
flex: 1;
min-height: 0;
position: relative;
}

.ui5-nl-aside {
margin: 0.5rem 0.5rem 0 0;
transition: transform 0.3s;
z-index: 1;
}

:host([is-phone]) .ui5-nl-aside,
:host([side-collapsed]) .ui5-nl-aside {
z-index: 3;
}

:host([is-phone]) .ui5-nl-aside {
margin: 0.25rem 0.25rem 0 0;
}

:host([is-phone]) .ui5-nl-aside {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 100%;
}

.ui5-nl-content {
flex: 1;
min-width: 0;
margin: 0.5rem 0 0 0;
z-index: 2;

box-shadow: var(--_ui5_nl_box_shadow);
border-radius: 0.5rem 0.5rem 0 0;
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
background: var(--sapBackgroundColor);
}

:host([is-phone]) .ui5-nl-content {
margin: 0.25rem 0 0 0;
}

:host([is-phone]) .ui5-nl-content,
:host([is-tablet]) .ui5-nl-content {
border-radius: 0.5rem;
}

:host([side-collapsed][is-phone]) .ui5-nl-aside {
transform: translateX(calc(-100% - 0.25rem));
}

::slotted([ui5-toolbar]),
TeodorTaushanov marked this conversation as resolved.
Show resolved Hide resolved
::slotted([ui5-shellbar]) {
box-shadow: var(--_ui5_nl_box_shadow);
border-radius: 0.5rem;
}
1 change: 1 addition & 0 deletions packages/fiori/src/themes/ShellBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
font-size: var(--sapFontSize);
font-weight: normal;
box-sizing: border-box;
border-radius: inherit;
}

.ui5-shellbar-menu-button,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:root {
--_ui5_nl_shadow_color1: color-mix(in srgb, var(--sapContent_ShadowColor) 16%, transparent);
--_ui5_nl_shadow_color2: color-mix(in srgb, var(--sapContent_ShadowColor) 16%, transparent);
--_ui5_nl_box_shadow: 0 0 0.125rem 0 var(--_ui5_nl_shadow_color1), 0 0.5rem 1rem 0 var(--_ui5_nl_shadow_color2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "./ProductSwitchItem-parameters.css";
@import "./ShellBar-parameters.css";
@import "./TimelineItem-parameters.css";
@import "../base/NavigationLayout-parameters.css";
@import "./SideNavigation-parameters.css";
@import "./UploadCollection-parameters.css";
@import "./Wizard-parameters.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "./ProductSwitchItem-parameters.css";
@import "./ShellBar-parameters.css";
@import "./TimelineItem-parameters.css";
@import "../base/NavigationLayout-parameters.css";
@import "./SideNavigation-parameters.css";
@import "./UploadCollection-parameters.css";
@import "./Wizard-parameters.css";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import "../base/NavigationLayout-parameters.css";

:root {
--_ui5_nl_shadow_color1: var(--sapContent_ShadowColor);
--_ui5_nl_shadow_color2: color-mix(in srgb, var(--sapContent_ShadowColor) 16%, transparent);
--_ui5_nl_box_shadow: 0 0 0 0.0625rem var(--_ui5_nl_shadow_color1), 0 0.5rem 1rem 0 var(--_ui5_nl_shadow_color2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "./ShellBar-parameters.css";
@import "./SideNavigation-parameters.css";
@import "./TimelineItem-parameters.css";
@import "./NavigationLayout-parameters.css";
@import "./UploadCollection-parameters.css";
@import "../base/ViewSettingsDialog-parameters.css";
@import "./Wizard-parameters.css";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import "../base/NavigationLayout-parameters.css";

:root {
--_ui5_nl_shadow_color1: var(--sapContent_ShadowColor);
--_ui5_nl_shadow_color2: color-mix(in srgb, var(--sapContent_ShadowColor) 16%, transparent);
--_ui5_nl_box_shadow: 0 0 0 0.0625rem var(--_ui5_nl_shadow_color1), 0 0.5rem 1rem 0 var(--_ui5_nl_shadow_color2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "../sap_horizon_hcb/ShellBar-parameters.css";
@import "./SideNavigation-parameters.css";
@import "./TimelineItem-parameters.css";
@import "./NavigationLayout-parameters.css";
@import "./UploadCollection-parameters.css";
@import "../base/ViewSettingsDialog-parameters.css";
@import "./Wizard-parameters.css";
Expand Down
Loading
Loading