UNPKG

@smitch/fluid

Version:

A lightweight, Tailwind-powered React/Next.js UI component library.

16 lines 1 kB
'use client'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { FaWhatsapp } from 'react-icons/fa'; import { Button } from '../..'; var WhatsAppButton = function (_a) { var text = _a.text, btnShape = _a.btnShape, size = _a.size; var handleShareClick = function () { var baseUrl = 'https://api.whatsapp.com/send'; var shareUrl = new URL(baseUrl); shareUrl.searchParams.set('text', "".concat(text, ": ").concat(window.location.href)); window.open(shareUrl.toString(), '_blank', 'noopener,noreferrer'); }; return (_jsxs(Button, { onClick: handleShareClick, btnBackground: 'primary', btnColor: 'light', layout: btnShape, size: size, title: 'Share on WhatsApp', className: 'hover:opacity-80 focus:text-light focus-visible:outline-accent bg-[#25D366]', children: [_jsx(FaWhatsapp, {}), _jsx("span", { className: 'sr-only', children: "Share on WhatsApp" })] })); }; export default WhatsAppButton; //# sourceMappingURL=WhatsappButton.js.map