UNPKG

@smitch/fluid

Version:

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

19 lines 1.04 kB
'use client'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { FaXTwitter } from 'react-icons/fa6'; import { Button } from '../..'; var XButton = function (_a) { var text = _a.text, btnShape = _a.btnShape, size = _a.size; var handleShareClick = function () { var baseUrl = 'https://x.com/intent/tweet'; var params = new URLSearchParams({ text: 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: 'primary', btnColor: 'light', layout: btnShape, size: size, title: 'Share on X', className: 'hover:opacity-80 focus:text-light focus-visible:outline-accent bg-[#000000]', children: [_jsx(FaXTwitter, {}), _jsx("span", { className: 'sr-only', children: "Share on X" })] })); }; export default XButton; //# sourceMappingURL=XButton.js.map