'use client'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; import { Slider } from '@/components/ui/slider'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import type { ErrorCorrectionLevel } from '@/types/qrcode'; interface QROptionsProps { errorCorrection: ErrorCorrectionLevel; foregroundColor: string; backgroundColor: string; margin: number; onErrorCorrectionChange: (ec: ErrorCorrectionLevel) => void; onForegroundColorChange: (color: string) => void; onBackgroundColorChange: (color: string) => void; onMarginChange: (margin: number) => void; } const EC_OPTIONS: { value: ErrorCorrectionLevel; label: string }[] = [ { value: 'L', label: 'Low (7%)' }, { value: 'M', label: 'Medium (15%)' }, { value: 'Q', label: 'Quartile (25%)' }, { value: 'H', label: 'High (30%)' }, ]; export function QROptions({ errorCorrection, foregroundColor, backgroundColor, margin, onErrorCorrectionChange, onForegroundColorChange, onBackgroundColorChange, onMarginChange, }: QROptionsProps) { const isTransparent = backgroundColor === '#00000000'; return ( Options {/* Error Correction */}
{/* Colors */}
onForegroundColorChange(e.target.value)} /> onForegroundColorChange(e.target.value)} />
onBackgroundColorChange(e.target.value)} /> onBackgroundColorChange(e.target.value)} />
{/* Margin */}
{margin}
onMarginChange(v)} min={0} max={8} step={1} />
); }