Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
calculatePosition(this: ResponsiveDropdown, ...args: any[]): object {
// On Desktop
const pos = calculatePosition(...args);
if (!this.useOverlay) {
if (pos && pos.style) {
pos.style.top += 10;
}
return pos;
}
// Prevent body scroll when modal is open
document.querySelector('body')!.classList.add('modal-open');
const [, content] = args;
const { height: dropdownHeight, width: dropdownWidth } = content.getBoundingClientRect();
content.style.marginLeft = `${-(dropdownWidth / 2)}px`;
content.style.marginTop = `${-(dropdownHeight / 2)}px`;
content.style.top = `${pos.style.top}px`;
content.style.left = '50%';
calculatePosition() {
let pos = calculatePosition(...arguments);
pos.style.top += 3;
return pos;
}
});