Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit ad06b2e

Browse files
yatebryanvu
authored andcommitted
make qr images sharper
1 parent 8321512 commit ad06b2e

File tree

1 file changed

+12
-6
lines changed
  • packages/lightning-components/QRCode

1 file changed

+12
-6
lines changed

packages/lightning-components/QRCode/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ import qrImage from 'qr-image'
55
export const QRCode = {
66
bitcoin: ({ address }) => {
77
const bitcoinURL = format({ protocol: 'bitcoin:', host: address })
8-
const svg = qrImage.imageSync(bitcoinURL, { type: 'svg' })
8+
const svg = qrImage.svgObject(bitcoinURL, { type: 'svg' })
99

10-
// eslint-disable-next-line react/no-danger
11-
return <div dangerouslySetInnerHTML={{ __html: svg }} />
10+
return (
11+
<svg viewBox={ "0 0 " + svg.size + " " + svg.size } shapeRendering="crispEdges">
12+
<path d={ svg.path }/>
13+
</svg>
14+
)
1215
},
1316
lightning: ({ paymentRequest }) => {
1417
paymentRequest = paymentRequest.replace('lightning://', 'lightning:')
15-
const svg = qrImage.imageSync(paymentRequest, { type: 'svg' })
18+
const svg = qrImage.svgObject(paymentRequest, { type: 'svg' })
1619

17-
// eslint-disable-next-line react/no-danger
18-
return <div dangerouslySetInnerHTML={{ __html: svg }} />
20+
return (
21+
<svg viewBox={ "0 0 " + svg.size + " " + svg.size } shapeRendering="crispEdges">
22+
<path d={ svg.path }/>
23+
</svg>
24+
)
1925
}
2026
}
2127

0 commit comments

Comments
 (0)