'use client'; import { Link as LinkIcon } from 'lucide-react'; interface BlogShareButtonsProps { url?: string; title?: string; } export const BlogShareButtons = ({ url, title }: BlogShareButtonsProps) => { // Build full URL from relative path const getFullUrl = () => { if (typeof window === 'undefined') return url || ''; if (url?.startsWith('http')) return url; return `${window.location.origin}${url || window.location.pathname}`; }; const shareUrl = getFullUrl(); const shareTitle = title || ''; const handleCopyLink = async () => { try { await navigator.clipboard.writeText(shareUrl); } catch (err) { console.error('Failed to copy link:', err); } }; const twitterUrl = `https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}&text=${encodeURIComponent(shareTitle)}`; const linkedinUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(shareUrl)}`; return (
); };