lbry-desktop/src/renderer/component/common/qr-code.jsx

34 lines
674 B
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
import React from 'react';
import QRCodeElement from 'qrcode.react';
import classnames from 'classnames';
2018-03-26 23:32:43 +02:00
type Props = {
value: string,
paddingRight?: boolean,
paddingTop?: boolean,
2018-03-26 23:32:43 +02:00
};
class QRCode extends React.Component<Props> {
static defaultProps = {
paddingRight: false,
paddingTop: false,
};
render() {
2018-06-13 17:43:04 +02:00
const { value, paddingRight, paddingTop } = this.props;
return (
<div
className={classnames('qr-code', {
'qr-code--right-padding': paddingRight,
'qr-code--top-padding': paddingTop,
})}
>
2018-06-13 17:43:04 +02:00
<QRCodeElement value={value} />
</div>
);
}
}
2018-03-26 23:32:43 +02:00
export default QRCode;