({
onCopyPostLink,
post,
link,
origin,
}: ShareMobileProps)
| 26 | } |
| 27 | |
| 28 | export function ShareMobile({ |
| 29 | onCopyPostLink, |
| 30 | post, |
| 31 | link, |
| 32 | origin, |
| 33 | }: ShareMobileProps): ReactElement { |
| 34 | const [copying] = useCopyPostLink(link); |
| 35 | const { openSharePost } = useSharePost(origin); |
| 36 | const { logEvent } = useLogContext(); |
| 37 | const { logOpts } = useContext(ActiveFeedContext); |
| 38 | |
| 39 | const onShare = () => { |
| 40 | logEvent( |
| 41 | postLogEvent(LogEvent.StartShareToSquad, post, { |
| 42 | ...(logOpts && logOpts), |
| 43 | }), |
| 44 | ); |
| 45 | openSharePost({ post }); |
| 46 | }; |
| 47 | |
| 48 | return ( |
| 49 | <WidgetContainer className="flex flex-col items-start gap-2 p-3 laptop:hidden"> |
| 50 | <Button |
| 51 | size={ButtonSize.Small} |
| 52 | onClick={onCopyPostLink} |
| 53 | pressed={copying} |
| 54 | icon={<LinkIcon />} |
| 55 | variant={ButtonVariant.Tertiary} |
| 56 | color={ButtonColor.Avocado} |
| 57 | > |
| 58 | {copying ? 'Copied!' : 'Copy link'} |
| 59 | </Button> |
| 60 | <Button |
| 61 | size={ButtonSize.Small} |
| 62 | onClick={onShare} |
| 63 | icon={<ShareIcon />} |
| 64 | variant={ButtonVariant.Tertiary} |
| 65 | color={ButtonColor.Cabbage} |
| 66 | > |
| 67 | Share with your friends |
| 68 | </Button> |
| 69 | </WidgetContainer> |
| 70 | ); |
| 71 | } |
nothing calls this directly
no test coverage detected