@bigbinary/neeto-molecules 1.0.83 → 1.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  import React, { useRef, useState, useEffect } from 'react';
2
2
  import { slugify, noop } from '@bigbinary/neeto-commons-frontend/pure';
3
3
  import { buildUrl, copyToClipboard } from '@bigbinary/neeto-commons-frontend/utils';
4
- import { Facebook, Linkedin, Twitter, Copy, ExternalLink, MenuHorizontal, QrCode } from '@bigbinary/neeto-icons';
5
- import { Modal, Typography, Input as Input$1, Button as Button$1, Dropdown, Tooltip } from '@bigbinary/neetoui';
6
- import { useTranslation } from 'react-i18next';
4
+ import { Facebook, Linkedin, Twitter, Copy, ExternalLink, MenuHorizontal } from '@bigbinary/neeto-icons';
5
+ import { Modal, Typography, Input as Input$1, Button as Button$1, Dropdown } from '@bigbinary/neetoui';
6
+ import { useTranslation, Trans } from 'react-i18next';
7
7
  import { Formik, Form } from 'formik';
8
8
  import { Input, Button } from '@bigbinary/neetoui/formik';
9
9
  import { t as t$1 } from 'i18next';
@@ -1195,7 +1195,7 @@ function QRCodeSVG(props) {
1195
1195
  shapeRendering: "crispEdges"
1196
1196
  }), image);
1197
1197
  }
1198
- var QRCode = (props) => {
1198
+ var QRCode$1 = (props) => {
1199
1199
  const _a = props, { renderAs } = _a, otherProps = __objRest(_a, ["renderAs"]);
1200
1200
  if (renderAs === "svg") {
1201
1201
  return /* @__PURE__ */ React.createElement(QRCodeSVG, __spreadValues({}, otherProps));
@@ -1203,14 +1203,9 @@ var QRCode = (props) => {
1203
1203
  return /* @__PURE__ */ React.createElement(QRCodeCanvas, __spreadValues({}, otherProps));
1204
1204
  };
1205
1205
 
1206
- var QRCodeModal = function QRCodeModal(_ref) {
1206
+ var QRCode = function QRCode(_ref) {
1207
1207
  var entity = _ref.entity,
1208
- entityName = _ref.entityName,
1209
- isOpen = _ref.isOpen,
1210
- onClose = _ref.onClose,
1211
1208
  url = _ref.url;
1212
- var _useTranslation = useTranslation(),
1213
- t = _useTranslation.t;
1214
1209
  if (!entity) return null;
1215
1210
  var id = entity.id,
1216
1211
  name = entity.name;
@@ -1221,58 +1216,50 @@ var QRCodeModal = function QRCodeModal(_ref) {
1221
1216
  name: slugify(name)
1222
1217
  });
1223
1218
  };
1224
- return /*#__PURE__*/React.createElement(Modal, {
1225
- "data-testid": "qr-code-modal",
1226
- isOpen: isOpen,
1227
- onClose: onClose
1228
- }, /*#__PURE__*/React.createElement(Modal.Header, {
1229
- description: t("neetoMolecules.shareViaLink.socialMediaShare.qrCodeInfo", {
1230
- entity: entityName
1231
- })
1219
+ return /*#__PURE__*/React.createElement("div", {
1220
+ className: "flex flex-col space-y-4"
1232
1221
  }, /*#__PURE__*/React.createElement(Typography, {
1233
- className: "mb-0.5",
1234
1222
  lineHeight: "normal",
1235
- style: "h3",
1236
- weight: "semibold"
1237
- }, t("neetoMolecules.shareViaLink.socialMediaShare.qrCodeDownload"))), /*#__PURE__*/React.createElement(Modal.Body, null, /*#__PURE__*/React.createElement(QRCode, {
1223
+ style: "body2",
1224
+ weight: "medium"
1225
+ }, /*#__PURE__*/React.createElement(Trans, {
1226
+ i18nKey: "neetoMolecules.shareViaLink.socialMediaShare.qrCodeInfo",
1227
+ components: {
1228
+ button: /*#__PURE__*/React.createElement(Button$1, {
1229
+ "data-testid": "qr-code-download-button",
1230
+ style: "link",
1231
+ onClick: handleDownload
1232
+ })
1233
+ }
1234
+ })), /*#__PURE__*/React.createElement(QRCode$1, {
1238
1235
  "data-testid": canvasId,
1239
1236
  id: canvasId,
1240
1237
  value: url
1241
- })), /*#__PURE__*/React.createElement(Modal.Footer, {
1242
- className: "space-x-2"
1243
- }, /*#__PURE__*/React.createElement(Button$1, {
1244
- "data-testid": "qr-code-download-button",
1245
- label: t("neetoMolecules.shareViaLink.socialMediaShare.qrCodeDownload"),
1246
- onClick: handleDownload
1247
- }), /*#__PURE__*/React.createElement(Button$1, {
1248
- label: t("neetoMolecules.common.actions.cancel"),
1249
- style: "text",
1250
- onClick: onClose
1251
- })));
1238
+ }));
1252
1239
  };
1253
1240
 
1254
1241
  var SocialMedia = function SocialMedia(_ref) {
1255
1242
  var entity = _ref.entity,
1256
- entityName = _ref.entityName,
1257
1243
  postTitle = _ref.postTitle,
1258
1244
  url = _ref.url;
1259
- var _useState = useState(false),
1260
- _useState2 = _slicedToArray(_useState, 2),
1261
- isQRCodeModalOpen = _useState2[0],
1262
- setIsQRCodeModalOpen = _useState2[1];
1263
1245
  var _useTranslation = useTranslation(),
1264
1246
  t = _useTranslation.t;
1265
1247
  var socialMediaButtonClasses = "neeto-ui-bg-gray-200 hover:neeto-ui-bg-gray-300 flex h-12 w-12 cursor-pointer items-center justify-center neeto-ui-rounded-md transition-colors duration-300 ease-in-out";
1266
1248
  return /*#__PURE__*/React.createElement("div", {
1267
- className: "space-y-4",
1249
+ className: "flex space-x-4 divide-x"
1250
+ }, /*#__PURE__*/React.createElement(QRCode, {
1251
+ entity: entity,
1252
+ url: url
1253
+ }), /*#__PURE__*/React.createElement("div", {
1254
+ className: "space-y-4 pl-4",
1268
1255
  "data-testid": "social-media-block"
1269
1256
  }, /*#__PURE__*/React.createElement(Typography, {
1270
1257
  className: "neeto-ui-text-gray-800",
1271
- lineHeight: "snug",
1258
+ lineHeight: "normal",
1272
1259
  style: "body2",
1273
1260
  weight: "medium"
1274
1261
  }, t("neetoMolecules.shareViaLink.socialMediaShare.title")), /*#__PURE__*/React.createElement("div", {
1275
- className: "flex items-center gap-4"
1262
+ className: "flex gap-4"
1276
1263
  }, Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref2) {
1277
1264
  var _ref3 = _slicedToArray(_ref2, 2),
1278
1265
  key = _ref3[0],
@@ -1294,23 +1281,7 @@ var SocialMedia = function SocialMedia(_ref) {
1294
1281
  }, /*#__PURE__*/React.createElement(Icon, {
1295
1282
  size: 24
1296
1283
  }));
1297
- }), /*#__PURE__*/React.createElement(Tooltip, {
1298
- content: t("neetoMolecules.shareViaLink.socialMediaShare.qrCode")
1299
- }, /*#__PURE__*/React.createElement("button", {
1300
- className: socialMediaButtonClasses,
1301
- "data-testid": "qr-code-button",
1302
- onClick: function onClick() {
1303
- return setIsQRCodeModalOpen(true);
1304
- }
1305
- }, /*#__PURE__*/React.createElement(QrCode, null)))), /*#__PURE__*/React.createElement(QRCodeModal, {
1306
- entity: entity,
1307
- entityName: entityName,
1308
- isOpen: isQRCodeModalOpen,
1309
- url: url,
1310
- onClose: function onClose() {
1311
- return setIsQRCodeModalOpen(false);
1312
- }
1313
- }));
1284
+ }))));
1314
1285
  };
1315
1286
 
1316
1287
  var ShareViaLink = function ShareViaLink(_ref) {
@@ -1350,9 +1321,8 @@ var ShareViaLink = function ShareViaLink(_ref) {
1350
1321
  url: url
1351
1322
  }), /*#__PURE__*/React.createElement(SocialMedia, {
1352
1323
  entity: entity,
1353
- entityName: entityName,
1354
- postTitle: socialMediaPostTitle,
1355
- url: url
1324
+ url: url,
1325
+ postTitle: socialMediaPostTitle
1356
1326
  }));
1357
1327
  };
1358
1328