import { LinkIcon } from '@heroicons/react/20/solid' import { useState } from 'react' import { FacebookShareButton, LinkedinShareButton, TwitterShareButton, } from 'react-share' import { FacebookIcon } from '~/components/icons/facebook' import { InstagramIcon } from '~/components/icons/instagram' import { LinkedinIcon } from '~/components/icons/linkedin' import { XIcon } from '~/components/icons/x' type SocialShareButtonsProperties = { url: string title: string } export const SocialShareButtons = ({ url, title, }: SocialShareButtonsProperties) => { const [showPopup, setShowPopup] = useState(false) const handleCopyLink = () => { navigator.clipboard.writeText(url) setShowPopup(true) setTimeout(() => setShowPopup(false), 2000) } const handleInstagramShare = () => { const instagramUrl = `https://www.instagram.com/direct/new/?text=${encodeURIComponent(title + ' ' + url)}` window.open(instagramUrl, '_blank') } return (
{showPopup && (
Link berhasil disalin!
)}
) }