From 05b276b3cde8aa9e9a67c28d4134b38b234f92f9 Mon Sep 17 00:00:00 2001 From: Gregor MacLennan Date: Wed, 2 Sep 2020 12:16:04 +0100 Subject: [PATCH] fix: Fix print button (still downloads, does not print) PrintButton was using `this.url` instead of `this.props.url`. However also removed some unnecessary code in this component --- .../MapFilter/ReportView/PrintButton.js | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/renderer/components/MapFilter/ReportView/PrintButton.js b/src/renderer/components/MapFilter/ReportView/PrintButton.js index 2f775872c..e474109d7 100644 --- a/src/renderer/components/MapFilter/ReportView/PrintButton.js +++ b/src/renderer/components/MapFilter/ReportView/PrintButton.js @@ -15,27 +15,18 @@ type Props = { url: string } -class PrintButton extends React.Component { - - download () { - var anchor = document.createElement('a') - anchor.href = this.url - anchor.download = 'report.pdf' - anchor.click() - } - - render () { - const { disabled } = this.props - - return ( - - - - - - - ) - } -} +const PrintButton = ({ url, disabled }: Props) => ( + + + + + + +) export default PrintButton