feature: add QRCode component

This commit is contained in:
George Lima 2018-12-05 15:37:42 -03:00
parent 3e48daace4
commit 8f2457e43e
2 changed files with 38 additions and 0 deletions

23
app/components/QRCode.mdx Normal file
View File

@ -0,0 +1,23 @@
---
name: QRCode
---
import { Playground, PropsTable } from 'docz'
import { QRCode } from './qrcode.js'
# QRCode
<PropsTable of={QRCode} />
## Basic usage
<Playground>
<QRCode value="https://astrocoders.com" />
</Playground>
## Custom size
<Playground>
<QRCode value="https://astrocoders.com" size={500} />
</Playground>

15
app/components/qrcode.js Normal file
View File

@ -0,0 +1,15 @@
// @flow
import React from 'react';
import QR from 'qrcode.react';
type Props = {
value: string,
size?: number,
};
export const QRCode = ({ value, size }: Props) => <QR value={value} size={size} />;
QRCode.defaultProps = {
size: 128,
};