UNPKG

@kwiz/fluentui

Version:
22 lines 807 B
import { jsx as _jsx } from "react/jsx-runtime"; import { colorToHex } from '@kwiz/common'; import QRCode from 'qrcode'; import { useEffect, useRef } from 'react'; export const QRCodeEX = (props) => { const container = useRef(); useEffect(() => { if (container.current) { let dark = props.foregroundColor ? colorToHex(props.foregroundColor) : "#000000ff"; let light = props.backgroundColor ? colorToHex(props.backgroundColor) : "#ffffffff"; QRCode.toCanvas(container.current, props.value, { color: { dark, light }, width: props.width }); } }, [container]); return (_jsx("canvas", { ref: container })); }; //# sourceMappingURL=qrcode.js.map