Refactor some code to make it looks cleaner
This commit is contained in:
@@ -11,26 +11,26 @@ export const ShareButtons = (props: {
|
||||
title: string;
|
||||
quote?: string | null;
|
||||
}) => {
|
||||
const url = `https://${Config.SiteDomain}/blog/${props.postId}`;
|
||||
const postURL = `https://${Config.SiteDomain}/blog/${props.postId}`;
|
||||
const copyShareText = `${props.title} ${props.subtitle ? `- ${props.subtitle}` : ""} - ${
|
||||
Config.Nickname
|
||||
}'s Blog ${url}`;
|
||||
}'s Blog ${postURL}`;
|
||||
const { toast } = useToast();
|
||||
return (
|
||||
<div className="my-3 flex space-x-4 text-2xl">
|
||||
{props.allowShare != false ? (
|
||||
<>
|
||||
<div className="my-auto text-sm font-bold">{"SHARE :"}</div>
|
||||
<FacebookShareButton className="mx-2" url={url} quote={props.quote ?? props.title}>
|
||||
<FacebookShareButton className="mx-2" url={postURL} quote={props.quote ?? props.title}>
|
||||
<FaFacebook title="Share to Facebook" className="hover:text-blue-500" />
|
||||
</FacebookShareButton>
|
||||
<TwitterShareButton className="mx-2" url={url} title={props.title}>
|
||||
<TwitterShareButton className="mx-2" url={postURL} title={props.title}>
|
||||
<FaTwitter title="Share to Twitter" className="hover:text-sky-500" />
|
||||
</TwitterShareButton>
|
||||
<LinkedinShareButton className="mx-2" url={url} title={props.title}>
|
||||
<LinkedinShareButton className="mx-2" url={postURL} title={props.title}>
|
||||
<FaLinkedin title="Share to Linkedin" className="hover:text-blue-500" />
|
||||
</LinkedinShareButton>
|
||||
<RedditShareButton className="mx-2" url={url} title={props.title}>
|
||||
<RedditShareButton className="mx-2" url={postURL} title={props.title}>
|
||||
<FaReddit title="Share to Reddit" className="hover:text-orange-500" />
|
||||
</RedditShareButton>
|
||||
<CopyToClipboard
|
||||
|
||||
Reference in New Issue
Block a user