separated AssetShareButtons component
This commit is contained in:
parent
461087ae7d
commit
fb47993ef5
4 changed files with 82 additions and 63 deletions
36
client/build/components/AssetShareButtons/index.js
Normal file
36
client/build/components/AssetShareButtons/index.js
Normal file
|
@ -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;
|
|
@ -17,6 +17,8 @@ var _Row = _interopRequireDefault(require("@components/Row"));
|
||||||
|
|
||||||
var _SpaceBetween = _interopRequireDefault(require("@components/SpaceBetween"));
|
var _SpaceBetween = _interopRequireDefault(require("@components/SpaceBetween"));
|
||||||
|
|
||||||
|
var _AssetShareButtons = _interopRequireDefault(require("@components/AssetShareButtons"));
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
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); }
|
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; }
|
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 ClickToCopy = function ClickToCopy(_ref) {
|
||||||
var host = _ref.host,
|
var id = _ref.id,
|
||||||
name = _ref.name,
|
value = _ref.value,
|
||||||
shortId = _ref.shortId;
|
copyToClipboard = _ref.copyToClipboard;
|
||||||
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;
|
|
||||||
return _react.default.createElement("input", {
|
return _react.default.createElement("input", {
|
||||||
id: id,
|
id: id,
|
||||||
value: value,
|
value: value,
|
||||||
|
@ -134,7 +113,7 @@ function (_React$Component) {
|
||||||
label: _react.default.createElement(_Label.default, {
|
label: _react.default.createElement(_Label.default, {
|
||||||
value: 'Share:'
|
value: 'Share:'
|
||||||
}),
|
}),
|
||||||
content: _react.default.createElement(AssetShareButtons, {
|
content: _react.default.createElement(_AssetShareButtons.default, {
|
||||||
host: host,
|
host: host,
|
||||||
name: name,
|
name: name,
|
||||||
shortId: shortId
|
shortId: shortId
|
||||||
|
|
38
client/src/components/AssetShareButtons/index.js
Normal file
38
client/src/components/AssetShareButtons/index.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const AssetShareButtons = ({ host, name, shortId }) => {
|
||||||
|
return (
|
||||||
|
<SpaceBetween >
|
||||||
|
<a
|
||||||
|
className='link--primary'
|
||||||
|
target='_blank'
|
||||||
|
href={`https://twitter.com/intent/tweet?text=${host}/${shortId}/${name}`}
|
||||||
|
>
|
||||||
|
twitter
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className='link--primary'
|
||||||
|
target='_blank'
|
||||||
|
href={`https://www.facebook.com/sharer/sharer.php?u=${host}/${shortId}/${name}`}
|
||||||
|
>
|
||||||
|
facebook
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className='link--primary'
|
||||||
|
target='_blank'
|
||||||
|
href={`http://tumblr.com/widgets/share/tool?canonicalUrl=${host}/${shortId}/${name}`}
|
||||||
|
>
|
||||||
|
tumblr
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className='link--primary'
|
||||||
|
target='_blank'
|
||||||
|
href={`https://www.reddit.com/submit?url=${host}/${shortId}/${name}&title=${name}`}
|
||||||
|
>
|
||||||
|
reddit
|
||||||
|
</a>
|
||||||
|
</SpaceBetween>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AssetShareButtons;
|
|
@ -4,41 +4,7 @@ import Label from '@components/Label';
|
||||||
import RowLabeled from '@components/RowLabeled';
|
import RowLabeled from '@components/RowLabeled';
|
||||||
import Row from '@components/Row';
|
import Row from '@components/Row';
|
||||||
import SpaceBetween from '@components/SpaceBetween';
|
import SpaceBetween from '@components/SpaceBetween';
|
||||||
|
import AssetShareButtons from '@components/AssetShareButtons';
|
||||||
const AssetShareButtons = ({ host, name, shortId }) => {
|
|
||||||
return (
|
|
||||||
<SpaceBetween >
|
|
||||||
<a
|
|
||||||
className='link--primary'
|
|
||||||
target='_blank'
|
|
||||||
href={`https://twitter.com/intent/tweet?text=${host}/${shortId}/${name}`}
|
|
||||||
>
|
|
||||||
twitter
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
className='link--primary'
|
|
||||||
target='_blank'
|
|
||||||
href={`https://www.facebook.com/sharer/sharer.php?u=${host}/${shortId}/${name}`}
|
|
||||||
>
|
|
||||||
facebook
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
className='link--primary'
|
|
||||||
target='_blank'
|
|
||||||
href={`http://tumblr.com/widgets/share/tool?canonicalUrl=${host}/${shortId}/${name}`}
|
|
||||||
>
|
|
||||||
tumblr
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
className='link--primary'
|
|
||||||
target='_blank'
|
|
||||||
href={`https://www.reddit.com/submit?url=${host}/${shortId}/${name}&title=${name}`}
|
|
||||||
>
|
|
||||||
reddit
|
|
||||||
</a>
|
|
||||||
</SpaceBetween>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const ClickToCopy = ({id, value, copyToClipboard}) => {
|
const ClickToCopy = ({id, value, copyToClipboard}) => {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue