mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
modals and mint removal
This commit is contained in:
1 parent
22d3675f2b
commit
a8faa03b49
4 files changed
+368
-165
No files matched your search
@@ -0,0 +1,106 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { X, Copy, Check, QrCode, Zap } from 'lucide-react';
|
||||
|
||||
interface QRModalProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
title: string;
|
||||
description: string;
|
||||
qrCodeUrl: string;
|
||||
content: string;
|
||||
icon?: 'qr' | 'zap';
|
||||
showCopyButton?: boolean;
|
||||
copiedText?: string | null;
|
||||
onCopy?: () => void;
|
||||
copyButtonText?: string;
|
||||
helpText?: string;
|
||||
}
|
||||
|
||||
export function QRModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
title,
|
||||
description,
|
||||
qrCodeUrl,
|
||||
content,
|
||||
icon = 'qr',
|
||||
showCopyButton = false,
|
||||
copiedText,
|
||||
onCopy,
|
||||
copyButtonText = 'Copy',
|
||||
helpText,
|
||||
}: QRModalProps) {
|
||||
if (!isOpen) return null;
|
||||
|
||||
const IconComponent = icon === 'zap' ? Zap : QrCode;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-[100] p-4">
|
||||
<Card className="w-full max-w-md border-0 shadow-lg bg-background">
|
||||
<CardHeader className="relative">
|
||||
<Button
|
||||
onClick={onClose}
|
||||
className="absolute top-2 right-2"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
<CardTitle className="flex items-center pr-8">
|
||||
<IconComponent className="h-5 w-5 mr-2" />
|
||||
{title}
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
{description}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="flex justify-center">
|
||||
<div className="bg-white dark:bg-gray-100 p-4 rounded-lg border shadow-sm">
|
||||
<img
|
||||
src={qrCodeUrl}
|
||||
alt={`${title} QR Code`}
|
||||
className="w-64 h-64 object-contain"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="text-center">
|
||||
<div className="bg-muted p-3 rounded-lg border font-mono text-sm break-all">
|
||||
{content}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{showCopyButton && onCopy && (
|
||||
<div className="flex gap-2 justify-center">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={onCopy}
|
||||
className="flex items-center gap-2"
|
||||
>
|
||||
{copiedText === content ? (
|
||||
<>
|
||||
<Check className="h-4 w-4" />
|
||||
Copied!
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Copy className="h-4 w-4" />
|
||||
{copyButtonText}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{helpText && (
|
||||
<div className="text-xs text-muted-foreground bg-muted/30 p-3 rounded text-center">
|
||||
{helpText}
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user