Files
property-pulse-nextjs/components/ShareButtons.jsx
T
2024-07-12 15:48:17 -04:00

55 lines
1.4 KiB
React

'use client';
import {
FacebookShareButton,
TwitterShareButton,
WhatsappShareButton,
EmailShareButton,
FacebookIcon,
TwitterIcon,
WhatsappIcon,
EmailIcon,
} from 'react-share';
const ShareButton = ({ property }) => {
const shareUrl = `http://${process.env.NEXT_PUBLIC_DOMAIN}/properties/${property._id}`;
return (
<>
<h3 className='text-xl font-bold text-center pt-2'>
Share This Property:
</h3>
<div className='flex gap-3 justify-center pb-5'>
<FacebookShareButton
url={shareUrl}
quote={property.name}
hashtag={`#${property.type}ForRent`}
>
<FacebookIcon size={40} round={true} />
</FacebookShareButton>
<TwitterShareButton
url={shareUrl}
title={property.name}
hashtags={[`${property.type}ForRent`]}
>
<TwitterIcon size={40} round={true} />
</TwitterShareButton>
<WhatsappShareButton
url={shareUrl}
title={property.name}
separator=':: '
>
<WhatsappIcon size={40} round={true} />
</WhatsappShareButton>
<EmailShareButton
url={shareUrl}
subject={property.name}
body={`Check out this property: ${shareUrl}`}
>
<EmailIcon size={40} round={true} />
</EmailShareButton>
</div>
</>
);
};
export default ShareButton;