2018-03-26 14:32:43 -07:00
|
|
|
// @flow
|
2019-04-03 00:56:58 -05:00
|
|
|
import React, { Suspense } from 'react';
|
2018-04-05 21:56:05 -04:00
|
|
|
import classnames from 'classnames';
|
2019-11-07 14:39:22 -05:00
|
|
|
import ReactQrCode from 'qrcode.react';
|
2019-04-03 00:56:58 -05:00
|
|
|
|
2018-03-26 14:32:43 -07:00
|
|
|
type Props = {
|
|
|
|
value: string,
|
2018-04-05 21:56:05 -04:00
|
|
|
paddingRight?: boolean,
|
2018-06-12 09:22:53 -04:00
|
|
|
paddingTop?: boolean,
|
2018-03-26 14:32:43 -07:00
|
|
|
};
|
|
|
|
|
2018-04-05 21:56:05 -04:00
|
|
|
class QRCode extends React.Component<Props> {
|
|
|
|
static defaultProps = {
|
|
|
|
paddingRight: false,
|
2018-06-12 09:22:53 -04:00
|
|
|
paddingTop: false,
|
2018-04-05 21:56:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2018-06-13 11:43:04 -04:00
|
|
|
const { value, paddingRight, paddingTop } = this.props;
|
2018-04-05 21:56:05 -04:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={classnames('qr-code', {
|
|
|
|
'qr-code--right-padding': paddingRight,
|
2018-06-12 09:22:53 -04:00
|
|
|
'qr-code--top-padding': paddingTop,
|
2018-04-05 21:56:05 -04:00
|
|
|
})}
|
|
|
|
>
|
2019-11-07 14:39:22 -05:00
|
|
|
<ReactQrCode value={value} />
|
2018-04-05 21:56:05 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-03-26 14:32:43 -07:00
|
|
|
|
|
|
|
export default QRCode;
|