From fb47993ef5f0bc2461ff29b10770c4644abe92d7 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 3 Jul 2018 10:48:37 -0700 Subject: [PATCH] separated AssetShareButtons component --- .../components/AssetShareButtons/index.js | 36 ++++++++++++++++++ client/build/containers/AssetInfo/view.js | 35 ++++------------- .../src/components/AssetShareButtons/index.js | 38 +++++++++++++++++++ client/src/containers/AssetInfo/view.jsx | 36 +----------------- 4 files changed, 82 insertions(+), 63 deletions(-) create mode 100644 client/build/components/AssetShareButtons/index.js create mode 100644 client/src/components/AssetShareButtons/index.js diff --git a/client/build/components/AssetShareButtons/index.js b/client/build/components/AssetShareButtons/index.js new file mode 100644 index 00000000..81d25996 --- /dev/null +++ b/client/build/components/AssetShareButtons/index.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var AssetShareButtons = function AssetShareButtons(_ref) { + var host = _ref.host, + name = _ref.name, + shortId = _ref.shortId; + return _react.default.createElement(SpaceBetween, null, _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://twitter.com/intent/tweet?text=".concat(host, "/").concat(shortId, "/").concat(name) + }, "twitter"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://www.facebook.com/sharer/sharer.php?u=".concat(host, "/").concat(shortId, "/").concat(name) + }, "facebook"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "http://tumblr.com/widgets/share/tool?canonicalUrl=".concat(host, "/").concat(shortId, "/").concat(name) + }, "tumblr"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://www.reddit.com/submit?url=".concat(host, "/").concat(shortId, "/").concat(name, "&title=").concat(name) + }, "reddit")); +}; + +var _default = AssetShareButtons; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/AssetInfo/view.js b/client/build/containers/AssetInfo/view.js index e9b8865a..69e29d3e 100644 --- a/client/build/containers/AssetInfo/view.js +++ b/client/build/containers/AssetInfo/view.js @@ -17,6 +17,8 @@ var _Row = _interopRequireDefault(require("@components/Row")); var _SpaceBetween = _interopRequireDefault(require("@components/SpaceBetween")); +var _AssetShareButtons = _interopRequireDefault(require("@components/AssetShareButtons")); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -37,33 +39,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -var AssetShareButtons = function AssetShareButtons(_ref) { - var host = _ref.host, - name = _ref.name, - shortId = _ref.shortId; - return _react.default.createElement(_SpaceBetween.default, null, _react.default.createElement("a", { - className: "link--primary", - target: "_blank", - href: "https://twitter.com/intent/tweet?text=".concat(host, "/").concat(shortId, "/").concat(name) - }, "twitter"), _react.default.createElement("a", { - className: "link--primary", - target: "_blank", - href: "https://www.facebook.com/sharer/sharer.php?u=".concat(host, "/").concat(shortId, "/").concat(name) - }, "facebook"), _react.default.createElement("a", { - className: "link--primary", - target: "_blank", - href: "http://tumblr.com/widgets/share/tool?canonicalUrl=".concat(host, "/").concat(shortId, "/").concat(name) - }, "tumblr"), _react.default.createElement("a", { - className: "link--primary", - target: "_blank", - href: "https://www.reddit.com/submit?url=".concat(host, "/").concat(shortId, "/").concat(name, "&title=").concat(name) - }, "reddit")); -}; - -var ClickToCopy = function ClickToCopy(_ref2) { - var id = _ref2.id, - value = _ref2.value, - copyToClipboard = _ref2.copyToClipboard; +var ClickToCopy = function ClickToCopy(_ref) { + var id = _ref.id, + value = _ref.value, + copyToClipboard = _ref.copyToClipboard; return _react.default.createElement("input", { id: id, value: value, @@ -134,7 +113,7 @@ function (_React$Component) { label: _react.default.createElement(_Label.default, { value: 'Share:' }), - content: _react.default.createElement(AssetShareButtons, { + content: _react.default.createElement(_AssetShareButtons.default, { host: host, name: name, shortId: shortId diff --git a/client/src/components/AssetShareButtons/index.js b/client/src/components/AssetShareButtons/index.js new file mode 100644 index 00000000..657b14a1 --- /dev/null +++ b/client/src/components/AssetShareButtons/index.js @@ -0,0 +1,38 @@ +import React from 'react'; + +const AssetShareButtons = ({ host, name, shortId }) => { + return ( + + + twitter + + + facebook + + + tumblr + + + reddit + + + ); +}; + +export default AssetShareButtons; diff --git a/client/src/containers/AssetInfo/view.jsx b/client/src/containers/AssetInfo/view.jsx index cf9091d2..9ce7d090 100644 --- a/client/src/containers/AssetInfo/view.jsx +++ b/client/src/containers/AssetInfo/view.jsx @@ -4,41 +4,7 @@ import Label from '@components/Label'; import RowLabeled from '@components/RowLabeled'; import Row from '@components/Row'; import SpaceBetween from '@components/SpaceBetween'; - -const AssetShareButtons = ({ host, name, shortId }) => { - return ( - - - twitter - - - facebook - - - tumblr - - - reddit - - - ); -}; +import AssetShareButtons from '@components/AssetShareButtons'; const ClickToCopy = ({id, value, copyToClipboard}) => { return (