feature: add QRCode component
This commit is contained in:
parent
3e48daace4
commit
8f2457e43e
|
@ -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>
|
|
@ -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,
|
||||
};
|
Loading…
Reference in New Issue