@stokr/components-library 2.3.22-beta.5 → 2.3.22
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.
- package/dist/components/BlogPost/BlogPost.js +7 -2
- package/dist/components/BlogPost/BlogPost.stories.js +7 -2
- package/dist/components/BlogPost/BlogPost.styles.js +42 -40
- package/dist/components/Icon/Icon2.js +29 -0
- package/dist/components/ShareButton/ShareButton.js +245 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _BlogPost = require("./BlogPost.styles");
|
|
10
10
|
var _breakdown = _interopRequireDefault(require("../breakdown"));
|
|
11
|
-
var _excluded = ["layout", "category", "title", "description", "image", "date", "link", "onClick", "onContainerClick", "CTAText"];
|
|
11
|
+
var _excluded = ["layout", "category", "title", "description", "image", "date", "link", "onClick", "onContainerClick", "withHoverBg", "CTAText"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -24,12 +24,15 @@ var BlogPost = function BlogPost(_ref) {
|
|
|
24
24
|
link = _ref.link,
|
|
25
25
|
_onClick = _ref.onClick,
|
|
26
26
|
onContainerClick = _ref.onContainerClick,
|
|
27
|
+
_ref$withHoverBg = _ref.withHoverBg,
|
|
28
|
+
withHoverBg = _ref$withHoverBg === void 0 ? false : _ref$withHoverBg,
|
|
27
29
|
_ref$CTAText = _ref.CTAText,
|
|
28
30
|
CTAText = _ref$CTAText === void 0 ? 'Read full' : _ref$CTAText,
|
|
29
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
32
|
return /*#__PURE__*/_react.default.createElement(_BlogPost.Container, _extends({
|
|
31
33
|
layout: layout
|
|
32
34
|
}, props, {
|
|
35
|
+
withHoverBg: withHoverBg,
|
|
33
36
|
onClick: function onClick() {
|
|
34
37
|
onContainerClick && onContainerClick();
|
|
35
38
|
}
|
|
@@ -40,7 +43,9 @@ var BlogPost = function BlogPost(_ref) {
|
|
|
40
43
|
alt: title
|
|
41
44
|
})), /*#__PURE__*/_react.default.createElement(_BlogPost.Content, {
|
|
42
45
|
layout: layout
|
|
43
|
-
}, /*#__PURE__*/_react.default.createElement(_BlogPost.Category,
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_BlogPost.Category, {
|
|
47
|
+
category: category
|
|
48
|
+
}, category), /*#__PURE__*/_react.default.createElement(_BlogPost.TextWrapper, null, /*#__PURE__*/_react.default.createElement("h3", null, title), description && layout !== 'image-fullscreen' && layout !== 'image-cover' && /*#__PURE__*/_react.default.createElement("p", null, description)), /*#__PURE__*/_react.default.createElement(_BlogPost.BottomRow, null, date && /*#__PURE__*/_react.default.createElement(_breakdown.default, null, date), /*#__PURE__*/_react.default.createElement(_BlogPost.StyledButton, {
|
|
44
49
|
transparent: true,
|
|
45
50
|
onClick: function onClick() {
|
|
46
51
|
if (link && !_onClick) window.location.href = link;
|
|
@@ -45,6 +45,9 @@ var _default = {
|
|
|
45
45
|
},
|
|
46
46
|
link: {
|
|
47
47
|
control: 'text'
|
|
48
|
+
},
|
|
49
|
+
withHoverBg: {
|
|
50
|
+
control: 'boolean'
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
};
|
|
@@ -67,7 +70,8 @@ ImageLeft.args = {
|
|
|
67
70
|
description: "It's the moment you have all been waiting for! Trading for the BMN token is now fully live and active on the Bitfinex Securities Exchange.",
|
|
68
71
|
image: 'https://res.cloudinary.com/stokr/image/upload/v1574418924/1_hoz9ve.jpg',
|
|
69
72
|
date: '01 MAR 2022',
|
|
70
|
-
link: '/blog/bitcoin-mining-series-part-1'
|
|
73
|
+
link: '/blog/bitcoin-mining-series-part-1',
|
|
74
|
+
withHoverBg: true
|
|
71
75
|
};
|
|
72
76
|
|
|
73
77
|
//https://res.cloudinary.com/stokr/image/upload/v1694077746/cld-sample-2.jpg
|
|
@@ -103,7 +107,7 @@ var samplePosts = [{
|
|
|
103
107
|
link: '/blog/post-1'
|
|
104
108
|
}, {
|
|
105
109
|
layout: 'image-left',
|
|
106
|
-
category: '
|
|
110
|
+
category: 'PODCAST',
|
|
107
111
|
title: 'What Is Portfolio Diversification and What Does A Diversified Portfolio Look Like? What Is Portfolio Diversification and What Does A Diversified Portfolio Look Like?What Is Portfolio Diversification and What Does A Diversified Portfolio Look Like?',
|
|
108
112
|
description: 'Trading for the BMN token is now fully live and active on the Bitfinex Securities Exchange.Trading for the BMN token is now fully live and active on the Bitfinex Securities Exchange.Trading for the BMN token is now fully live and active on the Bitfinex Securities Exchange.',
|
|
109
113
|
image: 'https://res.cloudinary.com/stokr/image/upload/v1694077746/cld-sample-2.jpg',
|
|
@@ -161,6 +165,7 @@ var GridExample = function GridExample(args) {
|
|
|
161
165
|
return /*#__PURE__*/_react.default.createElement(_BlogPost.default, _extends({
|
|
162
166
|
key: index
|
|
163
167
|
}, post, {
|
|
168
|
+
withHoverBg: true,
|
|
164
169
|
layout: getLayoutPattern(index)
|
|
165
170
|
}));
|
|
166
171
|
}))));
|
|
@@ -15,59 +15,58 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
18
|
-
var
|
|
19
|
-
displayName: "
|
|
18
|
+
var Content = _styledComponents.default.div.withConfig({
|
|
19
|
+
displayName: "BlogPoststyles__Content",
|
|
20
20
|
componentId: "sc-16n0gty-0"
|
|
21
|
-
})(["
|
|
21
|
+
})(["flex:", ";padding:", ";display:flex;flex-direction:column;gap:12px;word-break:break-word;transition:all 0.3s ease;position:", ";", " ", ""], function (_ref) {
|
|
22
22
|
var layout = _ref.layout;
|
|
23
|
-
return layout === 'image-
|
|
24
|
-
},
|
|
23
|
+
return layout === 'image-cover' || layout === 'image-fullscreen' ? '0' : '1';
|
|
24
|
+
}, function (_ref2) {
|
|
25
25
|
var layout = _ref2.layout;
|
|
26
|
-
return layout === 'image-cover' || layout === 'image-fullscreen' ? '
|
|
26
|
+
return layout === 'image-cover' || layout === 'image-fullscreen' ? '16px' : '16px 0';
|
|
27
27
|
}, function (_ref3) {
|
|
28
28
|
var layout = _ref3.layout;
|
|
29
|
-
return layout === 'image-
|
|
30
|
-
}
|
|
29
|
+
return layout === 'image-cover' || layout === 'image-fullscreen' ? 'absolute' : 'relative';
|
|
30
|
+
}, function (_ref4) {
|
|
31
|
+
var layout = _ref4.layout;
|
|
32
|
+
return (layout === 'image-cover' || layout === 'image-fullscreen') && (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n bottom: 0;\n left: 0;\n right: 0;\n color: ", ";\n "])), _theme.default.cWhite);
|
|
33
|
+
}, _rwd.default.Medium(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 24px;\n padding: 24px; \n\n ", ";\n\n ", ";\n \n "])), function (_ref5) {
|
|
34
|
+
var layout = _ref5.layout;
|
|
35
|
+
return layout === 'image-left' && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-right: 0;\n "])));
|
|
36
|
+
}, function (_ref6) {
|
|
37
|
+
var layout = _ref6.layout;
|
|
38
|
+
return layout === 'image-right' && (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-left: 0;\n "])));
|
|
39
|
+
}));
|
|
40
|
+
exports.Content = Content;
|
|
41
|
+
var Container = _styledComponents.default.div.withConfig({
|
|
42
|
+
displayName: "BlogPoststyles__Container",
|
|
43
|
+
componentId: "sc-16n0gty-1"
|
|
44
|
+
})(["position:relative;display:flex;flex-direction:column;background:", ";height:100%;min-height:400px;max-height:540px;transition:all 0.3s ease;", " ", " ", ""], _theme.default.cWhite, _rwd.default.Medium(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n\n flex-direction: ", ";\n min-height: 500px;\n\n ", "\n "])), function (_ref7) {
|
|
45
|
+
var layout = _ref7.layout;
|
|
46
|
+
return layout === 'image-cover' || layout === 'image-fullscreen' ? 'column' : layout === 'image-right' ? 'row-reverse' : 'row';
|
|
47
|
+
}, function (_ref8) {
|
|
48
|
+
var layout = _ref8.layout;
|
|
49
|
+
return layout === 'image-fullscreen' && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n grid-column: 1 / -1;\n "])));
|
|
50
|
+
}), _rwd.default.XLarge(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n min-height: 540px;\n "]))), function (props) {
|
|
51
|
+
return props.withHoverBg && "\n cursor:pointer;\n &:hover {\n box-shadow: 0 0 0 10px #fafafa;\n\n ".concat((props.layout === 'image-right' || props.layout === 'image-left') && "\n ".concat(Content, " {\n background-color: #fafafa;\n }\n "), "\n }\n ");
|
|
52
|
+
});
|
|
31
53
|
exports.Container = Container;
|
|
32
54
|
var ImageWrapper = _styledComponents.default.div.withConfig({
|
|
33
55
|
displayName: "BlogPoststyles__ImageWrapper",
|
|
34
|
-
componentId: "sc-16n0gty-
|
|
35
|
-
})(["position:relative;flex:", ";overflow:hidden;", ""], function (
|
|
36
|
-
var layout =
|
|
56
|
+
componentId: "sc-16n0gty-2"
|
|
57
|
+
})(["position:relative;flex:", ";overflow:hidden;", ""], function (_ref9) {
|
|
58
|
+
var layout = _ref9.layout;
|
|
37
59
|
return layout === 'image-cover' || layout === 'image-fullscreen' ? '1' : '0 0 50%';
|
|
38
|
-
}, function (
|
|
39
|
-
var layout =
|
|
40
|
-
return (layout === 'image-cover' || layout === 'image-fullscreen') && (0, _styledComponents.css)(
|
|
60
|
+
}, function (_ref10) {
|
|
61
|
+
var layout = _ref10.layout;
|
|
62
|
+
return (layout === 'image-cover' || layout === 'image-fullscreen') && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n &:after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.4);\n transition: background 0.3s ease;\n }\n "])));
|
|
41
63
|
});
|
|
42
64
|
exports.ImageWrapper = ImageWrapper;
|
|
43
65
|
var Image = _styledComponents.default.img.withConfig({
|
|
44
66
|
displayName: "BlogPoststyles__Image",
|
|
45
|
-
componentId: "sc-16n0gty-
|
|
67
|
+
componentId: "sc-16n0gty-3"
|
|
46
68
|
})(["width:100%;height:100%;object-fit:cover;"]);
|
|
47
69
|
exports.Image = Image;
|
|
48
|
-
var Content = _styledComponents.default.div.withConfig({
|
|
49
|
-
displayName: "BlogPoststyles__Content",
|
|
50
|
-
componentId: "sc-16n0gty-3"
|
|
51
|
-
})(["flex:", ";padding:", ";display:flex;flex-direction:column;gap:12px;word-break:break-word;position:", ";", " ", ""], function (_ref6) {
|
|
52
|
-
var layout = _ref6.layout;
|
|
53
|
-
return layout === 'image-cover' || layout === 'image-fullscreen' ? '0' : '1';
|
|
54
|
-
}, function (_ref7) {
|
|
55
|
-
var layout = _ref7.layout;
|
|
56
|
-
return layout === 'image-cover' || layout === 'image-fullscreen' ? '24px' : '16px 0';
|
|
57
|
-
}, function (_ref8) {
|
|
58
|
-
var layout = _ref8.layout;
|
|
59
|
-
return layout === 'image-cover' || layout === 'image-fullscreen' ? 'absolute' : 'relative';
|
|
60
|
-
}, function (_ref9) {
|
|
61
|
-
var layout = _ref9.layout;
|
|
62
|
-
return (layout === 'image-cover' || layout === 'image-fullscreen') && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n bottom: 0;\n left: 0;\n right: 0;\n color: ", ";\n "])), _theme.default.cWhite);
|
|
63
|
-
}, _rwd.default.Medium(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n gap: 24px;\n padding: 24px; \n\n ", ";\n\n ", ";\n \n "])), function (_ref10) {
|
|
64
|
-
var layout = _ref10.layout;
|
|
65
|
-
return layout === 'image-left' && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding-right: 0;\n "])));
|
|
66
|
-
}, function (_ref11) {
|
|
67
|
-
var layout = _ref11.layout;
|
|
68
|
-
return layout === 'image-right' && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding-left: 0;\n "])));
|
|
69
|
-
}));
|
|
70
|
-
exports.Content = Content;
|
|
71
70
|
var TextWrapper = _styledComponents.default.div.withConfig({
|
|
72
71
|
displayName: "BlogPoststyles__TextWrapper",
|
|
73
72
|
componentId: "sc-16n0gty-4"
|
|
@@ -76,12 +75,15 @@ exports.TextWrapper = TextWrapper;
|
|
|
76
75
|
var BottomRow = _styledComponents.default.div.withConfig({
|
|
77
76
|
displayName: "BlogPoststyles__BottomRow",
|
|
78
77
|
componentId: "sc-16n0gty-5"
|
|
79
|
-
})(["display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-top:auto;width:100%;"]);
|
|
78
|
+
})(["display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-top:auto;width:100%;gap:12px;"]);
|
|
80
79
|
exports.BottomRow = BottomRow;
|
|
81
80
|
var Category = (0, _styledComponents.default)(_breakdown.default).withConfig({
|
|
82
81
|
displayName: "BlogPoststyles__Category",
|
|
83
82
|
componentId: "sc-16n0gty-6"
|
|
84
|
-
})(["font-weight:500 !important;", ""],
|
|
83
|
+
})(["font-weight:500 !important;display:flex;align-items:center;gap:8px;", ""], function (_ref11) {
|
|
84
|
+
var category = _ref11.category;
|
|
85
|
+
return category === 'PODCAST' && (0, _styledComponents.css)(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n &::before {\n content: '';\n display: inline-block;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 6px 0 6px 8px;\n border-color: transparent transparent transparent ", ";\n }\n "])), _theme.default.cLightGrey);
|
|
86
|
+
});
|
|
85
87
|
exports.Category = Category;
|
|
86
88
|
var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
87
89
|
displayName: "BlogPoststyles__StyledButton",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Icon2 = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var Icons = _interopRequireWildcard(require("../icons"));
|
|
10
|
+
var _excluded = ["name"];
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
var Icon2 = function Icon2(_ref) {
|
|
17
|
+
var _ref$name = _ref.name,
|
|
18
|
+
name = _ref$name === void 0 ? 'IconNotFound' : _ref$name,
|
|
19
|
+
p = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var Ico = Icons[name];
|
|
21
|
+
if (typeof Ico === 'undefined') {
|
|
22
|
+
// -next-line
|
|
23
|
+
console.error("Icon name ".concat(name, " not found"));
|
|
24
|
+
}
|
|
25
|
+
return Ico ? /*#__PURE__*/_react.default.createElement(Ico, p) : null;
|
|
26
|
+
};
|
|
27
|
+
exports.Icon2 = Icon2;
|
|
28
|
+
var _default = Icon2;
|
|
29
|
+
exports.default = _default;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.socialSvg = exports.default = exports.ShareButton = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
|
+
var _theme = _interopRequireDefault(require("../../styles/theme"));
|
|
11
|
+
var _Facebook_Logo = _interopRequireDefault(require("../icons/Facebook_Logo.png"));
|
|
12
|
+
var _LIInBug = _interopRequireDefault(require("../icons/LI-In-Bug.png"));
|
|
13
|
+
var _XLogoBlack = _interopRequireDefault(require("../icons/X-logo-black.png"));
|
|
14
|
+
var _TelegramLogo = _interopRequireDefault(require("../icons/Telegram-Logo.png"));
|
|
15
|
+
var _Button = _interopRequireDefault(require("../Button/Button.styles"));
|
|
16
|
+
var _Icon = _interopRequireDefault(require("../Icon/Icon2"));
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
23
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
26
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
27
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
33
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
34
|
+
var duration = 700;
|
|
35
|
+
var Outer = _styledComponents.default.div.withConfig({
|
|
36
|
+
displayName: "ShareButton__Outer",
|
|
37
|
+
componentId: "sc-1yaoiai-0"
|
|
38
|
+
})(["display:inline-block;height:40px;position:relative;z-index:0;a{svg{fill:", " !important;transition:all 0.3s;}}a:hover{svg{fill:", " !important;}}"], _theme.default.cGray, _theme.default.cRed);
|
|
39
|
+
var rightCss = (0, _styledComponents.css)(["right:auto;left:-10px;padding-left:30px;padding-right:0;border-radius:5px 25px 25px 5px;border-left:0;border-right:1px solid ", ";"], _theme.default.cGray);
|
|
40
|
+
var openHelper = function openHelper(_ref) {
|
|
41
|
+
var right = _ref.right;
|
|
42
|
+
return right && rightCss;
|
|
43
|
+
};
|
|
44
|
+
var buttonsWrapperRightCss = (0, _styledComponents.css)(["right:auto;left:20px;"]);
|
|
45
|
+
var buttonsWrapperHelper = function buttonsWrapperHelper(_ref2) {
|
|
46
|
+
var right = _ref2.right;
|
|
47
|
+
return right && buttonsWrapperRightCss;
|
|
48
|
+
};
|
|
49
|
+
var ButtonsWrapper = _styledComponents.default.div.withConfig({
|
|
50
|
+
displayName: "ShareButton__ButtonsWrapper",
|
|
51
|
+
componentId: "sc-1yaoiai-1"
|
|
52
|
+
})(["position:absolute;top:50%;transform:translateY(-50%);overflow:hidden;width:", ";height:50px;right:20px;transition:all ", "ms ease-out;", ";"], function (_ref3) {
|
|
53
|
+
var open = _ref3.open;
|
|
54
|
+
return open ? '300px' : 0;
|
|
55
|
+
}, duration, buttonsWrapperHelper);
|
|
56
|
+
var Buttons = _styledComponents.default.div.withConfig({
|
|
57
|
+
displayName: "ShareButton__Buttons",
|
|
58
|
+
componentId: "sc-1yaoiai-2"
|
|
59
|
+
})(["display:flex;position:absolute;width:auto;white-space:nowrap;top:50%;right:0;transform:translateY(-50%);padding-right:20px;border-right:0;z-index:-2;overflow:hidden;transition-property:left,right,opacity;transition-duration:0.3s;", " ", "{margin-right:1px;border-radius:0;transition-property:color,background !important;position:relative;z-index:1;&:not(:first-child){border-left:1px solid ", " !important;}&:hover{color:", " !important;background:transparent !important;}&:focus,&:active{color:", " !important;border-left-color:transparent;&::before{opacity:1;}&::after{border-radius:50%;background:", " !important;}+ ", "::before{opacity:1;}}&::before{content:'';display:block;position:absolute;left:-1px;top:1px;bottom:1px;border-left:1px solid ", ";border-left-color:", ";z-index:1;opacity:0;transition:opacity 0.3s;}&::after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;z-index:-1;border-radius:30%;transition:all 0.3s;}}svg,img{width:24px;height:24px;}&::after{position:absolute;content:'';border:1px solid ", ";border-right:none;border-radius:25px 0 0 25px;background:", ";top:0;left:0;height:40px;width:100%;z-index:-1;", ";}", "{color:", ";}", ""], openHelper, _Button.default, _theme.default.cGrayLight, _theme.default.cRed, _theme.default.cWhite, _theme.default.cRed, _Button.default, _theme.default.cWhite, function (_ref4) {
|
|
60
|
+
var inverted = _ref4.inverted;
|
|
61
|
+
return inverted ? _theme.default.cBlue : _theme.default.cWhite;
|
|
62
|
+
}, _theme.default.cGrayLight, _theme.default.cWhite, function (_ref5) {
|
|
63
|
+
var inverted = _ref5.inverted;
|
|
64
|
+
return inverted && " background: ".concat(_theme.default.cBlue, ";");
|
|
65
|
+
}, _Button.default, _theme.default.cGray, function (props) {
|
|
66
|
+
return !props.inverted && "\n & > a:hover {\n background: ".concat(_theme.default.cGray, ";\n }\n ");
|
|
67
|
+
});
|
|
68
|
+
var activeCss = (0, _styledComponents.css)(["color:", ";background:", ";"], _theme.default.cWhite, _theme.default.cRed);
|
|
69
|
+
var activeHelper = function activeHelper(_ref6) {
|
|
70
|
+
var active = _ref6.active;
|
|
71
|
+
return active && activeCss;
|
|
72
|
+
};
|
|
73
|
+
var ShareButtonStyled = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
74
|
+
displayName: "ShareButton__ShareButtonStyled",
|
|
75
|
+
componentId: "sc-1yaoiai-3"
|
|
76
|
+
})(["z-index:10;color:", ";background:", ";border-color:", ";", ";&:hover{color:", ";background:", ";}svg,img{transition:unset !important;}> div{line-height:0;padding-left:2px;}"], function (_ref7) {
|
|
77
|
+
var startcolor = _ref7.startcolor;
|
|
78
|
+
return startcolor || _theme.default.cRed;
|
|
79
|
+
}, function (_ref8) {
|
|
80
|
+
var forceTransparency = _ref8.forceTransparency;
|
|
81
|
+
return forceTransparency ? 'transparent' : _theme.default.cWhite;
|
|
82
|
+
}, function (_ref9) {
|
|
83
|
+
var forceTransparency = _ref9.forceTransparency;
|
|
84
|
+
return forceTransparency ? _theme.default.cWhite : _theme.default.cGrayLight;
|
|
85
|
+
}, activeHelper, _theme.default.cWhite, _theme.default.cRed);
|
|
86
|
+
// parse class for <Icon />
|
|
87
|
+
var parseButtonClass = function parseButtonClass(input) {
|
|
88
|
+
var isFacebook = input.includes('facebook.');
|
|
89
|
+
if (isFacebook) return socialSvg.facebook;
|
|
90
|
+
var isLinkedIn = input.includes('linkedin.');
|
|
91
|
+
if (isLinkedIn) return socialSvg.linkedin;
|
|
92
|
+
var isTwitter = input.includes('twitter.');
|
|
93
|
+
if (isTwitter) return socialSvg.twitter;
|
|
94
|
+
var isTelegram = input.includes('telegram.');
|
|
95
|
+
if (isTelegram) return socialSvg.telegram;
|
|
96
|
+
// let isMedium = input.includes('medium.')
|
|
97
|
+
// if (isMedium) return 'Medium'
|
|
98
|
+
// let isYouTube = input.includes('youtube.')
|
|
99
|
+
// if (isYouTube) return 'Youtube'
|
|
100
|
+
return '';
|
|
101
|
+
};
|
|
102
|
+
var socialSvg = {
|
|
103
|
+
linkedin: /*#__PURE__*/_react.default.createElement("img", {
|
|
104
|
+
src: _LIInBug.default,
|
|
105
|
+
alt: "Linkedin Logo",
|
|
106
|
+
style: {
|
|
107
|
+
padding: 1
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
110
|
+
//instagram: <SocialInstagram />,
|
|
111
|
+
twitter: /*#__PURE__*/_react.default.createElement("img", {
|
|
112
|
+
src: _XLogoBlack.default,
|
|
113
|
+
alt: "X Logo",
|
|
114
|
+
style: {
|
|
115
|
+
padding: 2
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
118
|
+
facebook: /*#__PURE__*/_react.default.createElement("img", {
|
|
119
|
+
src: _Facebook_Logo.default,
|
|
120
|
+
alt: "Facebook Logo"
|
|
121
|
+
}),
|
|
122
|
+
telegram: /*#__PURE__*/_react.default.createElement("img", {
|
|
123
|
+
src: _TelegramLogo.default,
|
|
124
|
+
alt: "Telegram Logo"
|
|
125
|
+
})
|
|
126
|
+
//medium: <SocialMedium />,
|
|
127
|
+
// youtube: <img src={YtLogo} alt="Youtube Logo" />,
|
|
128
|
+
// reddit: <SocialReddit />,
|
|
129
|
+
};
|
|
130
|
+
exports.socialSvg = socialSvg;
|
|
131
|
+
var ShareButton = /*#__PURE__*/function (_Component) {
|
|
132
|
+
_inherits(ShareButton, _Component);
|
|
133
|
+
var _super = _createSuper(ShareButton);
|
|
134
|
+
function ShareButton() {
|
|
135
|
+
var _this;
|
|
136
|
+
_classCallCheck(this, ShareButton);
|
|
137
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
138
|
+
args[_key] = arguments[_key];
|
|
139
|
+
}
|
|
140
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
141
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
142
|
+
open: false,
|
|
143
|
+
activeShareButton: false //this state manages share button color and open state (used to keep share button red until the transition finishes)
|
|
144
|
+
});
|
|
145
|
+
_defineProperty(_assertThisInitialized(_this), "node", /*#__PURE__*/_react.default.createRef());
|
|
146
|
+
_defineProperty(_assertThisInitialized(_this), "handleOpen", function () {
|
|
147
|
+
return _this.setState(function (_ref10) {
|
|
148
|
+
var open = _ref10.open,
|
|
149
|
+
activeShareButton = _ref10.activeShareButton;
|
|
150
|
+
return {
|
|
151
|
+
open: !open,
|
|
152
|
+
activeShareButton: !activeShareButton
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
_defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (event) {
|
|
157
|
+
var current = _this.node.current;
|
|
158
|
+
if (current && !current.contains(event.target)) {
|
|
159
|
+
_this.setState({
|
|
160
|
+
open: false
|
|
161
|
+
});
|
|
162
|
+
setTimeout(function () {
|
|
163
|
+
_this.setState({
|
|
164
|
+
activeShareButton: false
|
|
165
|
+
});
|
|
166
|
+
}, duration);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return _this;
|
|
170
|
+
}
|
|
171
|
+
_createClass(ShareButton, [{
|
|
172
|
+
key: "componentDidMount",
|
|
173
|
+
value: function componentDidMount() {
|
|
174
|
+
document.addEventListener('mousedown', this.handleClickOutside);
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "componentWillUnmount",
|
|
178
|
+
value: function componentWillUnmount() {
|
|
179
|
+
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "render",
|
|
183
|
+
value: function render() {
|
|
184
|
+
var _this2 = this;
|
|
185
|
+
var _this$props = this.props,
|
|
186
|
+
forceTransparency = _this$props.forceTransparency,
|
|
187
|
+
inverted = _this$props.inverted,
|
|
188
|
+
startcolor = _this$props.startcolor,
|
|
189
|
+
right = _this$props.right,
|
|
190
|
+
blockContent = _this$props.blockContent;
|
|
191
|
+
var _this$state = this.state,
|
|
192
|
+
open = _this$state.open,
|
|
193
|
+
activeShareButton = _this$state.activeShareButton;
|
|
194
|
+
return /*#__PURE__*/_react.default.createElement(Outer, {
|
|
195
|
+
ref: this.node
|
|
196
|
+
}, /*#__PURE__*/_react.default.createElement(ShareButtonStyled, {
|
|
197
|
+
onClick: this.handleOpen,
|
|
198
|
+
color: "transparent",
|
|
199
|
+
inverted: inverted,
|
|
200
|
+
active: activeShareButton,
|
|
201
|
+
startcolor: startcolor,
|
|
202
|
+
forceTransparency: forceTransparency,
|
|
203
|
+
icononly: true,
|
|
204
|
+
id: "share-button"
|
|
205
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
206
|
+
name: "Share"
|
|
207
|
+
})), /*#__PURE__*/_react.default.createElement(ButtonsWrapper, {
|
|
208
|
+
open: open,
|
|
209
|
+
right: right,
|
|
210
|
+
inverted: inverted
|
|
211
|
+
}, /*#__PURE__*/_react.default.createElement(Buttons, {
|
|
212
|
+
right: right,
|
|
213
|
+
inverted: inverted,
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
return setTimeout(_this2.handleOpen, 550);
|
|
216
|
+
}
|
|
217
|
+
}, blockContent.socialMedia && blockContent.socialMedia.length > 0 && blockContent.socialMedia.map(function (item, index) {
|
|
218
|
+
if (item.uri !== '' && item.label.includes('Share')) return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
219
|
+
key: index,
|
|
220
|
+
icononly: true,
|
|
221
|
+
noborder: true,
|
|
222
|
+
color: "transparent",
|
|
223
|
+
as: "a",
|
|
224
|
+
href: item.uri,
|
|
225
|
+
target: "_blank",
|
|
226
|
+
rel: "noopener noreferrer"
|
|
227
|
+
}, parseButtonClass(item.uri));
|
|
228
|
+
return '';
|
|
229
|
+
}))));
|
|
230
|
+
}
|
|
231
|
+
}]);
|
|
232
|
+
return ShareButton;
|
|
233
|
+
}(_react.Component);
|
|
234
|
+
exports.ShareButton = ShareButton;
|
|
235
|
+
_defineProperty(ShareButton, "propTypes", {
|
|
236
|
+
inverted: _propTypes.default.bool,
|
|
237
|
+
startcolor: _propTypes.default.string,
|
|
238
|
+
right: _propTypes.default.bool,
|
|
239
|
+
forceTransparency: _propTypes.default.bool
|
|
240
|
+
});
|
|
241
|
+
_defineProperty(ShareButton, "defaultProps", {
|
|
242
|
+
startcolor: _theme.default.cRed
|
|
243
|
+
});
|
|
244
|
+
var _default = ShareButton;
|
|
245
|
+
exports.default = _default;
|