@smitch/fluid
Version:
A lightweight, Tailwind-powered React/Next.js UI component library.
16 lines • 1.01 kB
JavaScript
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { MdEmail } from 'react-icons/md';
import { Button } from '../..';
var EmailButton = function (_a) {
var text = _a.text, btnShape = _a.btnShape, size = _a.size;
var handleShareClick = function () {
var subject = encodeURIComponent(document.title);
var body = encodeURIComponent("".concat(text, "\n\n").concat(window.location.href));
var mailtoUrl = "mailto:?subject=".concat(subject, "&body=").concat(body);
window.open(mailtoUrl, '_blank', 'noopener,noreferrer');
};
return (_jsxs(Button, { onClick: handleShareClick, btnBackground: 'info', btnColor: 'light', layout: btnShape, size: size, title: 'Share via Email', className: 'hover:opacity-80 focus:text-light focus-visible:outline-accent bg-[#0072C6]', children: [_jsx(MdEmail, {}), _jsx("span", { className: 'sr-only', children: "Share via Email" })] }));
};
export default EmailButton;
//# sourceMappingURL=EmailButton.js.map