import { useToast } from "@/components/ui/use-toast"; import { Config } from "@/data/config"; import { FacebookShareButton, LinkedinShareButton, RedditShareButton, TwitterShareButton } from "next-share"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { FaFacebook, FaLink, FaLinkedin, FaReddit, FaTwitter } from "react-icons/fa6"; export const ShareButtons = (props: { postId: string; allowShare?: boolean | null; subtitle?: string | null; title: string; quote?: string | null; }) => { const postURL = encodeURI(`https://${Config.SiteDomain}/blog/${props.postId}`); const copyShareText = `${props.title} ${props.subtitle ? `- ${props.subtitle}` : ""} - ${ Config.Nickname }'s Blog ${postURL}`; const { toast } = useToast(); return (
{props.allowShare !== false ? ( <> { toast({ description: "Link is copied successfully" }); }} text={copyShareText} > ) : (
{"SHARING IS NOT ALLOWED"}
)}
); };