Skip to content

Commit 6ba1102

Browse files
chore(ui5-navigation-layout): add constant for the screen width (#12857)
Replace hard‑coded 600px with SCREEN_WIDTH_BREAKPOINT Jira: 3570
1 parent c176feb commit 6ba1102

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/fiori/src/NavigationLayout.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import NavigationLayoutTemplate from "./NavigationLayoutTemplate.js";
1212
// Styles
1313
import NavigationLayoutCss from "./generated/themes/NavigationLayout.css.js";
1414

15+
const SCREEN_WIDTH_BREAKPOINT = 600;
16+
1517
/**
1618
* @class
1719
*
@@ -49,7 +51,7 @@ import NavigationLayoutCss from "./generated/themes/NavigationLayout.css.js";
4951
template: NavigationLayoutTemplate,
5052
})
5153
class NavigationLayout extends UI5Element {
52-
_defaultSideCollapsed = window.innerWidth < 600; // Small screens (599px or less)
54+
_defaultSideCollapsed = window.innerWidth < SCREEN_WIDTH_BREAKPOINT;
5355

5456
/**
5557
* Specifies the navigation layout mode.

packages/fiori/src/SideNavigation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import SideNavigationCss from "./generated/themes/SideNavigation.css.js";
3838
import SideNavigationPopoverCss from "./generated/themes/SideNavigationPopover.css.js";
3939

4040
const PAGE_UP_DOWN_SIZE = 10;
41+
const SCREEN_WIDTH_BREAKPOINT = 600;
4142

4243
type SideNavigationPopoverContents = {
4344
item: SideNavigationItem,
@@ -483,7 +484,7 @@ class SideNavigation extends UI5Element {
483484

484485
handleResize() {
485486
// In smaller screen the side navigation hidden when collapsed and there is no overflow items
486-
if (window.innerWidth > 600) {
487+
if (window.innerWidth > SCREEN_WIDTH_BREAKPOINT) {
487488
this._updateOverflowItems();
488489
}
489490
}

packages/fiori/src/types/NavigationLayoutMode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
enum NavigationLayoutMode {
66
/**
7-
* Automatically calculates the navigation layout mode based on the screen device type.
7+
* Automatically calculates the navigation layout mode based on the screen width.
88
* `Collapsed` on small screens (screen width of 599px or less) and `Expanded` on larger screens (screen width of 600px or more).
99
* @public
1010
*/

0 commit comments

Comments
 (0)