From 156c6ea36ceb080ca4be007bcfdda52e907937aa Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 31 Aug 2022 16:23:10 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20position=20of=20=E2=80=9Cexpand=E2=80=9D?= =?UTF-8?q?=20icon=20in=20media=20modal=20on=20glitch-soc=20(#1838)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flavours/glitch/components/icon_button.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/components/icon_button.js b/app/javascript/flavours/glitch/components/icon_button.js index 9ff745355f..c0664ec890 100644 --- a/app/javascript/flavours/glitch/components/icon_button.js +++ b/app/javascript/flavours/glitch/components/icon_button.js @@ -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'; }