UNPKG

@kwiz/fluentui

Version:

KWIZ common controls for FluentUI

28 lines 953 B
import { jsx as _jsx } from "react/jsx-runtime"; import { makeStyles } from '@fluentui/react-components'; import { colorToHex } from '@kwiz/common'; import QRCode from 'qrcode'; import { useEffect, useRef } from 'react'; const useStyles = makeStyles({ center: { justifyContent: 'center' }, }); 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