diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-10-19 16:36:36 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-10-19 16:36:36 +0200 |
| commit | 4d2a8463c5c542c9c386ae0d4110a85dfabaf9cb (patch) | |
| tree | 0791bcc4889fb4d84b9dc03e4693c7e7abe49af7 /gui/src | |
| parent | a702afabaee292e92a80a1d6c0a75f80f2babb8d (diff) | |
| parent | 69fd0355d799c9fe5af9a9a7b50af99229781c77 (diff) | |
| download | mullvadvpn-4d2a8463c5c542c9c386ae0d4110a85dfabaf9cb.tar.xz mullvadvpn-4d2a8463c5c542c9c386ae0d4110a85dfabaf9cb.zip | |
Merge branch 'fix-app-button-console-warning' into master
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/renderer/components/AppButton.tsx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gui/src/renderer/components/AppButton.tsx b/gui/src/renderer/components/AppButton.tsx index d99d1494f5..54a3039078 100644 --- a/gui/src/renderer/components/AppButton.tsx +++ b/gui/src/renderer/components/AppButton.tsx @@ -47,7 +47,7 @@ export interface IProps extends React.HTMLAttributes<HTMLButtonElement> { } const BaseButton = React.memo(function BaseButtonT(props: IProps) { - const { children, ...otherProps } = props; + const { children, textOffset, ...otherProps } = props; const [textAdjustment, setTextAdjustment] = useState(0); const buttonRef = useRef() as React.RefObject<HTMLButtonElement>; @@ -66,8 +66,7 @@ const BaseButton = React.memo(function BaseButtonT(props: IProps) { const trailingSpace = buttonRect.width - (leftDiff + textRect.width); // calculate text adjustment - const textOffset = props.textOffset ?? 0; - const textAdjustment = leftDiff - trailingSpace - textOffset; + const textAdjustment = leftDiff - trailingSpace - (textOffset ?? 0); // re-render the view with the new text adjustment if it changed setTextAdjustment(textAdjustment); |
