'use client'; import { useState } from 'react'; import { Share2, Check, Link as LinkIcon } from 'lucide-react'; export default function ShareButton({ title, url }) { const [copied, setCopied] = useState(false); async function share() { const fullUrl = url || (typeof window !== 'undefined' ? window.location.href : ''); if (typeof navigator !== 'undefined' && navigator.share) { try { await navigator.share({ title, url: fullUrl }); } catch { // отмена пользователем — игнор } } else { try { await navigator.clipboard.writeText(fullUrl); setCopied(true); setTimeout(() => setCopied(false), 1800); } catch {} } } return ( ); }