Skip to content

Commit 8491f76

Browse files
committed
UI improvements for the heade
1 parent 429fd5b commit 8491f76

File tree

3 files changed

+346
-149
lines changed

3 files changed

+346
-149
lines changed

src/bundle/Resources/public/js/scripts/edit.header.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(function (global, doc, ibexa) {
22
const SCROLL_POSITION_TO_FIT = 50;
3-
const HEADER_RIGHT_MARGIN = 50;
43
const MIN_HEIGHT_DIFF_FOR_FITTING_HEADER = 150;
54
const headerNode = doc.querySelector('.ibexa-edit-header');
65
const contentNode = doc.querySelector('.ibexa-edit-content');
@@ -9,24 +8,9 @@
98
return;
109
}
1110

12-
const headerBottomRowNode = headerNode.querySelector('.ibexa-edit-header__row--bottom');
1311
const { height: expandedHeaderHeight } = headerNode.getBoundingClientRect();
1412
const scrolledContent = doc.querySelector('.ibexa-edit-content > :first-child');
1513
const { controlZIndex } = ibexa.helpers.modal;
16-
const fitEllipsizedTitle = () => {
17-
const titleNode = headerBottomRowNode.querySelector('.ibexa-edit-header__name--ellipsized');
18-
const firstMenuEntryNode = headerNode.querySelector('.ibexa-context-menu .ibexa-context-menu__item');
19-
const { left: titleNodeLeft, width: titleNodeWidth } = titleNode.getBoundingClientRect();
20-
const { left: firstMenuEntryNodeLeft } = firstMenuEntryNode.getBoundingClientRect();
21-
const bottomRowNodeWidthNew = firstMenuEntryNodeLeft - titleNodeLeft;
22-
const titleNodeWidthNew = bottomRowNodeWidthNew - HEADER_RIGHT_MARGIN;
23-
24-
headerBottomRowNode.style.width = `${bottomRowNodeWidthNew}px`;
25-
26-
if (titleNodeWidth > titleNodeWidthNew) {
27-
titleNode.style.width = `${titleNodeWidthNew}px`;
28-
}
29-
};
3014
const fitHeader = (event) => {
3115
const { height: formHeight } = scrolledContent.getBoundingClientRect();
3216
const contentHeightWithExpandedHeader = formHeight + expandedHeaderHeight;
@@ -40,12 +24,6 @@
4024
const shouldHeaderBeSlim = scrollTop > SCROLL_POSITION_TO_FIT;
4125

4226
headerNode.classList.toggle('ibexa-edit-header--slim', shouldHeaderBeSlim);
43-
44-
if (shouldHeaderBeSlim) {
45-
fitEllipsizedTitle();
46-
} else {
47-
headerBottomRowNode.style.width = '100%';
48-
}
4927
};
5028

5129
contentNode.addEventListener('scroll', fitHeader, false);

0 commit comments

Comments
 (0)