Skip to content

Commit

Permalink
chore(dropdown): remove whitespace and console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
QuintonJason committed Oct 19, 2023
1 parent 2b234b8 commit 91cd220
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/sage-system/lib/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ Sage.dropdown = (function () {
const panel = el.lastElementChild;
const win = panel.ownerDocument.defaultView;
const docEl = window.document.documentElement;

panel.style.top = ''; // resets the style
panel.style.left = ''; // resets the style
panel.style.right = ''; // resets the style

// Dimensions
const buttonDimensions = button.getBoundingClientRect();
const panelDimensions = panel.getBoundingClientRect();

const panelNewLoc = {
top: (buttonDimensions.height / 2) + panelDimensions.height,
left: (buttonDimensions.width / 2) + panelDimensions.width,
Expand All @@ -225,7 +225,7 @@ Sage.dropdown = (function () {
bottom: (panelDimensions.top + win.pageYOffset),
right: (panelDimensions.left + win.pageXOffset),
};

const panelHeight = getHeight(panel);
const panelWidth = panelDimensions.width;
const enoughSpaceAbove = viewport.top < (offset.top + panelHeight);
Expand All @@ -239,7 +239,7 @@ Sage.dropdown = (function () {
} else if (!enoughSpaceAbove && enoughSpaceBelow) {
directionY = 'below';
}

if (directionY === 'above') {
panel.style.top = `-${panelNewLoc.top}px`;
} else if (directionY === 'below') {
Expand All @@ -261,9 +261,6 @@ Sage.dropdown = (function () {
panel.style.left = 0;
panel.style.right = 'inherit';
}

console.log('directionX', directionX);
console.log('directionY', directionY);
}

function open(el) {
Expand Down

0 comments on commit 91cd220

Please sign in to comment.