UNPKG

@mornya/react-social-libs

Version:

The project of React.js Social Share and Widget modules.

77 lines (76 loc) 3.33 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; import React from 'react'; import { BaseShareComponent } from '../utils/BaseShareComponent'; import { initFlipboardSDK } from '../utils/Loader'; var Flipboard = (function (_super) { __extends(Flipboard, _super); function Flipboard() { var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this; _this.onClickShareFlipboard = function (_e) { _this.onClickShare(); setTimeout(function () { return _this.onComplete(true, null); }, 1000); }; _this.renderShareButton = function (_a) { var id = _a.id, label = _a.label, className = _a.className, style = _a.style; return (React.createElement("div", { id: id, title: label, className: className, style: style }, React.createElement("a", { href: Flipboard.LINK_URL, "data-flip-widget": "flipit2", "data-flip-size": "small", className: "share-default-button x128", style: { width: _this.props.defaultIconSize, height: _this.props.defaultIconSize, }, onClick: _this.onClickShareFlipboard }, "Add this page to a Flipboard Magazine"))); }; return _this; } Flipboard.prototype.onInit = function () { this.initialize('Flipboard', { message: function (_OG) { return ''; }, }); }; Flipboard.prototype.onMount = function (_extra) { var _this = this; initFlipboardSDK() .then(function () { return _this.setApiStep(); }) .catch(console.error); }; Flipboard.LINK_URL = 'https://flipboard.com'; return Flipboard; }(BaseShareComponent)); export default Flipboard;