Skip to content

Commit

Permalink
Minor placement adjustment to expand control element
Browse files Browse the repository at this point in the history
  • Loading branch information
mkanet committed Apr 6, 2024
1 parent 316c268 commit 3deaf17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.3
0.5.4
16 changes: 8 additions & 8 deletions upcoming-media-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,21 +885,21 @@ class UpcomingMediaCard extends HTMLElement {
border-radius: 50%;
`;
const setExpandControlPosition = () => {
let verticalOffset = 57;
if (!this.content.children[this.collapse - 1]) {
let placeholderExists = controlContainer.querySelector('.placeholder');
expandControl.style.position = 'absolute';
if (placeholderExists) {
expandControl.style.marginTop = '9px';
expandControl.style.marginRight = '1px';
} else {
expandControl.style.marginTop = '0px';
expandControl.style.top = '42px';
}
expandControl.style.right = '1px';
} else {
let targetItem = this.content.children[this.collapse - 1];
let nextItem = this.content.children[this.collapse];
let targetRect = targetItem.getBoundingClientRect();
let containerRect = this.content.getBoundingClientRect();
let verticalOffset = 46; // Adjust this value to change the vertical position of the expand control when placeholder is not present
expandControl.style.marginTop = `calc(${targetRect.bottom - containerRect.top + (nextItem ? 10 : 0) + verticalOffset}px)`;
let targetRect = targetItem.getBoundingClientRect();
expandControl.style.position = 'absolute';
expandControl.style.top = `${targetRect.bottom - containerRect.top + verticalOffset}px`;
expandControl.style.right = '1px';
}
};
setTimeout(setExpandControlPosition, 0);
Expand Down

0 comments on commit 3deaf17

Please sign in to comment.