import * as Popover from '@radix-ui/react-popover' import type { CSSProperties } from 'react' import { useState } from 'react' import { QRCodeSVG } from 'qrcode.react' import { useClipboard } from '@/hooks/useClipboard' import { Z_INDEX } from '@/constants/zIndex' export interface QRCodeButtonProps { /** * The URL to encode in the QR code and display */ url: string /** * Optional custom styles for the trigger button */ style?: CSSProperties } /** * Button that opens a popover with a QR code for the share link * Includes the URL text with a copy button */ export function QRCodeButton({ url, style }: QRCodeButtonProps) { const [open, setOpen] = useState(false) const { copied, copy } = useClipboard() const buttonStyles: CSSProperties = { cursor: 'pointer', transition: 'all 0.2s ease', display: 'flex', alignItems: 'center', justifyContent: 'center', border: '2px solid rgba(251, 146, 60, 0.4)', background: 'linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(251, 146, 60, 0.3))', borderRadius: '8px', padding: '6px', fontSize: '16px', color: 'rgba(253, 186, 116, 1)', aspectRatio: '1', alignSelf: 'stretch', flexShrink: 0, ...style, } const hoverStyles: CSSProperties = { background: 'linear-gradient(135deg, rgba(251, 146, 60, 0.3), rgba(251, 146, 60, 0.4))', borderColor: 'rgba(251, 146, 60, 0.6)', } return ( {/* Title */}
Scan to Join
{/* QR Code */}
{/* URL with copy button */}
Or copy link:
) }