Skip to content

Commit

Permalink
wip9
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri Mandrikov committed Jan 10, 2024
1 parent 6a2f077 commit a7b5bed
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions enapter-commands-panel/src/hooks/useButtonTextResizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const transformText = (button: HTMLButtonElement) => {
svgIcon.parentElement.style.display = 'contents';
}

svgIcon.setAttribute('width', `${fontSize}px`);
svgIcon.setAttribute('height', `${fontSize}px`);
svgIcon.setAttribute('style', `margin-right: ${fontSize / 2}px`);
svgIcon.setAttribute('width', `0.8em`);
svgIcon.setAttribute('height', `0.8em`);
svgIcon.setAttribute('style', `margin-right: max(0.35em,8px)`);
}

const textContainer = button.querySelector('span');
Expand All @@ -51,15 +51,17 @@ const resetText = (button: HTMLButtonElement) => {
return;
}

button.removeAttribute('style');

const svgIcon = button.querySelector('svg');

if (svgIcon) {
if (svgIcon.parentElement) {
svgIcon.parentElement.style.display = 'inline-block';
}

svgIcon.setAttribute('width', '1rem');
svgIcon.setAttribute('height', '1rem');
svgIcon.setAttribute('width', '16px');
svgIcon.setAttribute('height', '16px');
svgIcon.removeAttribute('style');
}

Expand Down

0 comments on commit a7b5bed

Please sign in to comment.