Share buttons

This commit is contained in:
Brad Traversy
2024-07-12 15:48:42 -04:00
parent 7ff195b2b3
commit 58aba3d48b
+9 -6
View File
@@ -10,8 +10,8 @@ import {
EmailIcon, EmailIcon,
} from 'react-share'; } from 'react-share';
const ShareButton = ({ property }) => { const ShareButtons = ({ property }) => {
const shareUrl = `http://${process.env.NEXT_PUBLIC_DOMAIN}/properties/${property._id}`; const shareUrl = `${process.env.NEXT_PUBLIC_DOMAIN}/properties/${property._id}`;
return ( return (
<> <>
@@ -22,17 +22,19 @@ const ShareButton = ({ property }) => {
<FacebookShareButton <FacebookShareButton
url={shareUrl} url={shareUrl}
quote={property.name} quote={property.name}
hashtag={`#${property.type}ForRent`} hashtag={`#${property.type.replace(/\s/g, '')}ForRent`}
> >
<FacebookIcon size={40} round={true} /> <FacebookIcon size={40} round={true} />
</FacebookShareButton> </FacebookShareButton>
<TwitterShareButton <TwitterShareButton
url={shareUrl} url={shareUrl}
title={property.name} title={property.name}
hashtags={[`${property.type}ForRent`]} hashtags={[`${property.type.replace(/\s/g, '')}ForRent`]}
> >
<TwitterIcon size={40} round={true} /> <TwitterIcon size={40} round={true} />
</TwitterShareButton> </TwitterShareButton>
<WhatsappShareButton <WhatsappShareButton
url={shareUrl} url={shareUrl}
title={property.name} title={property.name}
@@ -40,10 +42,11 @@ const ShareButton = ({ property }) => {
> >
<WhatsappIcon size={40} round={true} /> <WhatsappIcon size={40} round={true} />
</WhatsappShareButton> </WhatsappShareButton>
<EmailShareButton <EmailShareButton
url={shareUrl} url={shareUrl}
subject={property.name} subject={property.name}
body={`Check out this property: ${shareUrl}`} body={`Check out this property listing: ${shareUrl}`}
> >
<EmailIcon size={40} round={true} /> <EmailIcon size={40} round={true} />
</EmailShareButton> </EmailShareButton>
@@ -51,4 +54,4 @@ const ShareButton = ({ property }) => {
</> </>
); );
}; };
export default ShareButton; export default ShareButtons;