File tree 3 files changed +15
-35
lines changed
src/front/shared/components/QR
3 files changed +15
-35
lines changed Original file line number Diff line number Diff line change 1
1
# editors
2
2
3
3
.idea
4
+ .vscode
4
5
.DS_Store
5
6
.eslintcache
6
7
* -lock. *
Original file line number Diff line number Diff line change 241
241
"graphql-request" : " ^3.4.0" ,
242
242
"history" : " ^4.9.0" ,
243
243
"human-standard-token-abi" : " ^2.0.0" ,
244
+ "ip" : " ^2.0.1" ,
244
245
"is-local-ip" : " ^1.1.0" ,
245
246
"jdenticon" : " ^3.1.0" ,
246
247
"json-stringify-safe" : " ^5.0.1" ,
272
273
"react-items-carousel" : " ^2.8.0" ,
273
274
"react-joyride" : " ^2.3.0" ,
274
275
"react-loading-skeleton" : " ^3.0.1" ,
276
+ "react-qr-code" : " ^2.0.12" ,
275
277
"react-redux" : " ^7.2.2" ,
276
278
"react-router" : " ^5.2.0" ,
277
279
"react-router-dom" : " ^5.2.0" ,
Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react'
2
2
import CSSModules from 'react-css-modules'
3
- import animateFetching from 'components/loaders/ContentLoader/ElementLoading.scss'
3
+ import QRCode from "react-qr-code"
4
4
5
5
import styles from './QR.scss'
6
6
7
7
type ComponentProps = {
8
8
address : string
9
9
}
10
10
11
- type ComponentState = {
12
- qrIsLoaded : boolean
13
- }
14
-
15
- @CSSModules ( { ...styles , ...animateFetching } , { allowMultiple : true } )
16
- export default class QR extends Component < ComponentProps , ComponentState > {
11
+ @CSSModules ( { ...styles } , { allowMultiple : true } )
12
+ export default class QR extends Component < ComponentProps , any > {
17
13
18
14
constructor ( props ) {
19
15
super ( props )
20
-
21
- this . state = {
22
- qrIsLoaded : false ,
23
- }
24
- }
25
-
26
- setSuccessLoading = ( ) => {
27
- const { qrIsLoaded } = this . state
28
-
29
- if ( ! qrIsLoaded ) {
30
- this . setState ( ( ) => ( {
31
- qrIsLoaded : true
32
- } ) )
33
- }
34
16
}
35
17
36
18
render ( ) {
37
19
const { address } = this . props
38
- const { qrIsLoaded } = this . state
39
- const size = 270
40
20
41
21
return (
42
- < >
43
- < div className = { styles . relativeWrapper } >
44
- < div className = { styles . imageWrapper } >
45
- < img
46
- styleName = { `${ qrIsLoaded ? '' : 'hiddenEl' } ` }
47
- src = { `https://chart.googleapis.com/chart?chs=${ size } x${ size } &cht=qr&chl=${ address } ` }
48
- onLoad = { this . setSuccessLoading }
49
- alt = { address }
50
- />
51
- < span styleName = { `imageLoader ${ qrIsLoaded ? 'hiddenEl' : 'animate-fetching' } ` } />
52
- </ div >
22
+ < div className = { styles . relativeWrapper } >
23
+ < div className = { styles . imageWrapper } >
24
+ < QRCode
25
+ size = { 270 }
26
+ value = { address }
27
+ bgColor = "var(--color-background)"
28
+ fgColor = "var(--color)"
29
+ />
53
30
</ div >
54
- </ >
31
+ </ div >
55
32
)
56
33
}
57
34
}
You can’t perform that action at this time.
0 commit comments