import React, { useState } from 'react' import { LinkIcon } from '@heroicons/react/outline' import clsx from 'clsx' import { copyToClipboard } from 'web/lib/util/copy' import { ToastClipboard } from 'web/components/toast-clipboard' import { track } from 'web/lib/service/analytics' import { IconButton } from './button' export function ShareIconButton(props: { toastClassName?: string children?: React.ReactNode iconClassName?: string copyPayload: string }) { const { toastClassName, children, iconClassName, copyPayload } = props const [showToast, setShowToast] = useState(false) return (
{ copyToClipboard(copyPayload) track('copy share link') setShowToast(true) setTimeout(() => setShowToast(false), 2000) }} > {showToast && }
) }