Fix ApmButton margin condition.

This commit is contained in:
Pedro Silva 2023-12-12 10:18:28 +00:00
parent ec0dd5221d
commit c59f6de143
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3

View file

@ -73,24 +73,18 @@ export class ApmButtons {
}
// Check first apm button
const $firstApmButton = $container.find(this.selector + ':visible').first();
const $firstElement = $container.children(':visible').first();
let isFirstElement = false;
if ($firstApmButton.is($firstElement)) {
isFirstElement = true;
}
// Assign margins to buttons
$container.find(this.selector).each((index, el) => {
const $el = jQuery(el);
const height = $el.height();
if (isFirstElement) {
if ($el.is($firstElement)) {
$el.css('margin-top', `0px`);
return true;
}
const height = $el.height();
$el.css('margin-top', `${Math.round(height * 0.3)}px`);
});