import { DemoStory } from '../../demo/demo-types'; import { QRCode, QRCodeProps } from './qrcode'; interface QRCodeDemoArgs { value: string; size: number; fgColor: string; bgColor: string; level: 'L' | 'M' | 'Q' | 'H'; logoSrc: string; logoSize: number; } export const qrcodeDemo: DemoStory = { id: 'qrcode-demo', text: 'QR Code', args: { value: 'https://lupine.js.org/', size: 180, fgColor: '#000000', bgColor: '#FFFFFF', level: 'H', logoSrc: '', logoSize: 36, }, argTypes: { value: { control: 'text', description: 'URL or text to encode into the QR code' }, size: { control: 'number', description: 'Width and height of the QR code (px)' }, fgColor: { control: 'color', description: 'Foreground (module) color' }, bgColor: { control: 'color', description: 'Background color' }, level: { control: 'select', options: ['L', 'M', 'Q', 'H'], description: 'Error correction level (L=7%, M=15%, Q=25%, H=30%)', }, logoSrc: { control: 'file', description: 'Logo image to embed in center (upload an image file)' }, logoSize: { control: 'number', description: 'Logo image width & height (px)' }, }, render: (args: QRCodeDemoArgs) => { const imageSettings: QRCodeProps['imageSettings'] = args.logoSrc ? { src: args.logoSrc, width: args.logoSize, height: args.logoSize, excavate: true } : undefined; return (

Interactive QR Code

Customise the settings in the controls panel on the right.

Colored — High Error Correction

With Excavated Logo

); }, code: `import { QRCode } from 'lupine.components/component-pool/qrcode'; // Basic usage // With logo excavation `, };