]> cat aescling's git repositories - mastodon.git/commitdiff
Fix position of “expand” icon in media modal on glitch-soc (#1838)
authorClaire <claire.github-309c@sitedethib.com>
Wed, 31 Aug 2022 14:23:10 +0000 (16:23 +0200)
committeraescling <aescling+gitlab@cat.family>
Mon, 5 Sep 2022 04:28:03 +0000 (00:28 -0400)
app/javascript/flavours/glitch/components/icon_button.js

index 9ff745355fc5258d6c6be49fd5d3eb7f5d6fd3ab..c0664ec890f8f108a6713d5c5833c519087b37a9 100644 (file)
@@ -84,15 +84,21 @@ export default class IconButton extends React.PureComponent {
   }
 
   render () {
+    // Hack required for some icons which have an overriden size
+    let containerSize = '1.28571429em';
+    if (this.props.style?.fontSize) {
+      containerSize = `${this.props.size * 1.28571429}px`;
+    }
+
     let style = {
       fontSize: `${this.props.size}px`,
-      height: '1.28571429em',
+      height: containerSize,
       lineHeight: `${this.props.size}px`,
       ...this.props.style,
       ...(this.props.active ? this.props.activeStyle : {}),
     };
     if (!this.props.label) {
-      style.width = '1.28571429em';
+      style.width = containerSize;
     } else {
       style.textAlign = 'left';
     }