@smitch/fluid
Version:
A lightweight, Tailwind-powered React/Next.js UI component library.
19 lines • 1.1 kB
JavaScript
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FaPinterestP } from 'react-icons/fa';
import { Button } from '../..';
var PinterestButton = function (_a) {
var text = _a.text, btnShape = _a.btnShape, size = _a.size;
var handleShareClick = function () {
var baseUrl = 'https://pinterest.com/pin/create/button/';
var params = new URLSearchParams({
description: text.replace(/(\r\n|\n|\r)/g, ' '),
url: window.location.href,
});
var shareUrl = "".concat(baseUrl, "?").concat(params.toString());
window.open(shareUrl, '_blank', 'noopener,noreferrer');
};
return (_jsxs(Button, { onClick: handleShareClick, btnBackground: 'danger', btnColor: 'light', layout: btnShape, size: size, title: 'Share on Pinterest', className: 'hover:opacity-80 focus:text-light focus-visible:outline-accent bg-[#E60023]', children: [_jsx(FaPinterestP, {}), _jsx("span", { className: 'sr-only', children: "Share on Pinterest" })] }));
};
export default PinterestButton;
//# sourceMappingURL=PinterestButton.js.map