chore: refactor function

This commit is contained in:
Ephraim Atta-Duncan
2023-09-25 11:21:39 +00:00
parent b2e916378d
commit 78498793fa
2 changed files with 6 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import { HTMLAttributes } from 'react';
import { Copy, Share, Twitter } from 'lucide-react';
import { generateTwitterIntent } from '@documenso/lib/universal/generate-twitter-intent';
import { trpc } from '@documenso/trpc/react';
import { Button } from '@documenso/ui/primitives/button';
import {
@ -21,12 +22,6 @@ export type ShareButtonProps = HTMLAttributes<HTMLButtonElement> & {
documentId: number;
};
const generateTwitterIntent = (text: string, shareUrl: string) => {
return `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}%0A${encodeURIComponent(
shareUrl,
)}`;
};
export const ShareButton = ({ token, documentId }: ShareButtonProps) => {
const { toast } = useToast();
const [, copyToClipboard] = useCopyToClipboard();

View File

@ -0,0 +1,5 @@
export const generateTwitterIntent = (text: string, shareUrl: string) => {
return `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}%0A${encodeURIComponent(
shareUrl,
)}`;
};