@kids-reporter/draft-renderer 1.0.12 → 1.0.14
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/lib/block-render-maps/annotation.js +8 -7
- package/lib/block-render-maps/article-brief.js +5 -4
- package/lib/block-render-maps/article-content.js +10 -9
- package/lib/block-render-maps/image-link.js +4 -3
- package/lib/block-render-maps/index.js +1 -1
- package/lib/block-render-maps/info-box.js +9 -8
- package/lib/block-render-maps/project-content.js +10 -9
- package/lib/block-renderers/blockquote.js +27 -14
- package/lib/block-renderers/divider.js +2 -1
- package/lib/block-renderers/dropdown.js +25 -18
- package/lib/block-renderers/embedded-code-block.js +19 -16
- package/lib/block-renderers/image-block.js +49 -30
- package/lib/block-renderers/image-link.js +50 -34
- package/lib/block-renderers/index.js +1 -1
- package/lib/block-renderers/info-box-block.js +31 -21
- package/lib/block-renderers/multimedia.js +1 -1
- package/lib/block-renderers/news-reading.js +16 -14
- package/lib/block-renderers/slideshow-block.js +92 -77
- package/lib/draft-renderer.js +40 -44
- package/lib/entity-decorators/anchor.js +5 -3
- package/lib/entity-decorators/annotation-decorator.js +25 -21
- package/lib/entity-decorators/index.js +1 -1
- package/lib/entity-decorators/link-decorator.js +14 -2
- package/lib/entity-decorators/toc-anchor.js +5 -3
- package/lib/global.d.js +12 -0
- package/lib/index.js +2 -2
- package/lib/utils/index.js +2 -2
- package/package.json +10 -8
|
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ImageLinkInInfoBox = exports.ImageLinkInArticleBody = exports.ImageLinkBlock = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
7
|
var _draftJs = require("draft-js");
|
|
10
8
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
11
|
-
var
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
12
11
|
var _index = _interopRequireDefault(require("../block-render-maps/index"));
|
|
13
12
|
var _index2 = require("../entity-decorators/index");
|
|
14
|
-
var _mediaQuery = require("../utils/media-query");
|
|
15
13
|
var _constants = require("../utils/constants");
|
|
16
|
-
|
|
14
|
+
var _mediaQuery = require("../utils/media-query");
|
|
15
|
+
var _imageBlock = require("./image-block");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
function
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
const fallbackImg = '/assets/images/image_placeholder.png';
|
|
21
21
|
const Figure = _styledComponents.default.figure`
|
|
22
22
|
width: 100%;
|
|
@@ -26,10 +26,10 @@ const Img = _styledComponents.default.img`
|
|
|
26
26
|
object-fit: contain;
|
|
27
27
|
${props => props.$isDesktopAndAbove ? 'cursor: zoom-in;' : ''};
|
|
28
28
|
`;
|
|
29
|
-
|
|
29
|
+
function ImageLinkBlockInner({
|
|
30
30
|
className = '',
|
|
31
31
|
data
|
|
32
|
-
})
|
|
32
|
+
}) {
|
|
33
33
|
const theme = (0, _styledComponents.useTheme)();
|
|
34
34
|
const {
|
|
35
35
|
url,
|
|
@@ -52,23 +52,35 @@ const ImageLinkBlock = ({
|
|
|
52
52
|
const commonImgProps = {
|
|
53
53
|
src: url ?? fallbackImg
|
|
54
54
|
};
|
|
55
|
-
const imgBlock = /*#__PURE__*/
|
|
56
|
-
className: className
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
55
|
+
const imgBlock = /*#__PURE__*/(0, _jsxRuntime.jsxs)(Figure, {
|
|
56
|
+
className: className,
|
|
57
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Img, {
|
|
58
|
+
...commonImgProps,
|
|
59
|
+
$isDesktopAndAbove: isDesktopAndAbove,
|
|
60
|
+
onClick: () => {
|
|
61
|
+
var _handleImgModalOpen, _ref;
|
|
62
|
+
return isDesktopAndAbove && (theme === null || theme === void 0 || (_handleImgModalOpen = (_ref = theme).handleImgModalOpen) === null || _handleImgModalOpen === void 0 ? void 0 : _handleImgModalOpen.call(_ref, commonImgProps));
|
|
63
|
+
}
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_draftJs.Editor, {
|
|
65
|
+
blockRenderMap: blockRenderMap,
|
|
66
|
+
editorState: editorState,
|
|
67
|
+
readOnly: true,
|
|
68
|
+
onChange: () => {}
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
71
|
return imgBlock;
|
|
72
|
+
}
|
|
73
|
+
const ImageLinkBlock = ({
|
|
74
|
+
className = '',
|
|
75
|
+
data
|
|
76
|
+
}) => {
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledComponents.ThemeProvider, {
|
|
78
|
+
theme: {},
|
|
79
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageLinkBlockInner, {
|
|
80
|
+
className: className,
|
|
81
|
+
data: data
|
|
82
|
+
})
|
|
83
|
+
});
|
|
72
84
|
};
|
|
73
85
|
exports.ImageLinkBlock = ImageLinkBlock;
|
|
74
86
|
const ArticleBodyContainer = _styledComponents.default.div`
|
|
@@ -112,6 +124,8 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
112
124
|
margin: 5px 27px 5px 0px;
|
|
113
125
|
}
|
|
114
126
|
`;
|
|
127
|
+
default:
|
|
128
|
+
return '';
|
|
115
129
|
}
|
|
116
130
|
}}
|
|
117
131
|
`;
|
|
@@ -119,23 +133,25 @@ const ImageLinkInArticleBody = ({
|
|
|
119
133
|
className = '',
|
|
120
134
|
data
|
|
121
135
|
}) => {
|
|
122
|
-
return /*#__PURE__*/
|
|
136
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleBodyContainer, {
|
|
123
137
|
$alignment: data.alignment,
|
|
124
|
-
className: className
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
className: className,
|
|
139
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageLinkBlock, {
|
|
140
|
+
data: data
|
|
141
|
+
})
|
|
142
|
+
});
|
|
128
143
|
};
|
|
129
144
|
exports.ImageLinkInArticleBody = ImageLinkInArticleBody;
|
|
130
145
|
const ImageLinkInInfoBox = ({
|
|
131
146
|
className = '',
|
|
132
147
|
data
|
|
133
148
|
}) => {
|
|
134
|
-
return /*#__PURE__*/
|
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_imageBlock.InfoBoxContainer, {
|
|
135
150
|
$alignment: data.alignment,
|
|
136
|
-
className: className
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
className: className,
|
|
152
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageLinkBlock, {
|
|
153
|
+
data: data
|
|
154
|
+
})
|
|
155
|
+
});
|
|
140
156
|
};
|
|
141
157
|
exports.ImageLinkInInfoBox = ImageLinkInInfoBox;
|
|
@@ -10,8 +10,8 @@ var _embeddedCodeBlock = require("./embedded-code-block");
|
|
|
10
10
|
var _imageBlock = require("./image-block");
|
|
11
11
|
var _imageLink = require("./image-link");
|
|
12
12
|
var _infoBoxBlock = require("./info-box-block");
|
|
13
|
-
var _slideshowBlock = require("./slideshow-block");
|
|
14
13
|
var _newsReading = require("./news-reading");
|
|
14
|
+
var _slideshowBlock = require("./slideshow-block");
|
|
15
15
|
const blockRenderers = exports.blockRenderers = {
|
|
16
16
|
BlockquoteInArticleBody: _blockquote.BlockquoteInArticleBody,
|
|
17
17
|
Divider: _divider.Divider,
|
|
@@ -10,9 +10,10 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
10
10
|
var _index = _interopRequireDefault(require("../block-render-maps/index"));
|
|
11
11
|
var _imageBlock = require("../block-renderers/image-block");
|
|
12
12
|
var _imageLink = require("../block-renderers/image-link");
|
|
13
|
-
var _index2 = require("../
|
|
14
|
-
var _index3 = require("../
|
|
13
|
+
var _index2 = require("../entity-decorators/index");
|
|
14
|
+
var _index3 = require("../utils/index");
|
|
15
15
|
var _mediaQuery = require("../utils/media-query");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -58,7 +59,9 @@ const ClearFloat = _styledComponents.default.div`
|
|
|
58
59
|
function NewsChargeStation({
|
|
59
60
|
children
|
|
60
61
|
}) {
|
|
61
|
-
return /*#__PURE__*/
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(NewsChargeStationContainer, {
|
|
63
|
+
children: children
|
|
64
|
+
});
|
|
62
65
|
}
|
|
63
66
|
const HeaderBorderContainer = _styledComponents.default.div`
|
|
64
67
|
${({
|
|
@@ -67,19 +70,19 @@ const HeaderBorderContainer = _styledComponents.default.div`
|
|
|
67
70
|
let logoColor;
|
|
68
71
|
let bgColor;
|
|
69
72
|
switch (theme === null || theme === void 0 ? void 0 : theme.themeColor) {
|
|
70
|
-
case
|
|
73
|
+
case _index3.ThemeColorEnum.YELLOW:
|
|
71
74
|
{
|
|
72
75
|
logoColor = 'red';
|
|
73
76
|
bgColor = '#fff0d2';
|
|
74
77
|
break;
|
|
75
78
|
}
|
|
76
|
-
case
|
|
79
|
+
case _index3.ThemeColorEnum.RED:
|
|
77
80
|
{
|
|
78
81
|
logoColor = 'blue';
|
|
79
82
|
bgColor = '#ffd2d2';
|
|
80
83
|
break;
|
|
81
84
|
}
|
|
82
|
-
case
|
|
85
|
+
case _index3.ThemeColorEnum.BLUE:
|
|
83
86
|
default:
|
|
84
87
|
{
|
|
85
88
|
logoColor = 'yellow';
|
|
@@ -110,7 +113,9 @@ const HeaderBorderContainer = _styledComponents.default.div`
|
|
|
110
113
|
function HeaderBorder({
|
|
111
114
|
children
|
|
112
115
|
}) {
|
|
113
|
-
return /*#__PURE__*/
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HeaderBorderContainer, {
|
|
117
|
+
children: children
|
|
118
|
+
});
|
|
114
119
|
}
|
|
115
120
|
const BoxBorderContainer = _styledComponents.default.div`
|
|
116
121
|
${containerStyles}
|
|
@@ -122,7 +127,7 @@ const BoxBorderContainer = _styledComponents.default.div`
|
|
|
122
127
|
theme
|
|
123
128
|
}) => `
|
|
124
129
|
&::before {
|
|
125
|
-
background-image: url(https://www.unpkg.com/@kids-reporter/draft-renderer/public/images/info-box-blocksy-child-2-${(theme === null || theme === void 0 ? void 0 : theme.themeColor) ||
|
|
130
|
+
background-image: url(https://www.unpkg.com/@kids-reporter/draft-renderer/public/images/info-box-blocksy-child-2-${(theme === null || theme === void 0 ? void 0 : theme.themeColor) || _index3.ThemeColorEnum.BLUE}.png);
|
|
126
131
|
}`}
|
|
127
132
|
|
|
128
133
|
&::before {
|
|
@@ -138,7 +143,9 @@ const BoxBorderContainer = _styledComponents.default.div`
|
|
|
138
143
|
function BoxBorder({
|
|
139
144
|
children
|
|
140
145
|
}) {
|
|
141
|
-
return /*#__PURE__*/
|
|
146
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BoxBorderContainer, {
|
|
147
|
+
children: children
|
|
148
|
+
});
|
|
142
149
|
}
|
|
143
150
|
const ArticleBodyContainer = _styledComponents.default.div`
|
|
144
151
|
max-width: 700px;
|
|
@@ -160,7 +167,7 @@ function InfoBoxInArticleBody({
|
|
|
160
167
|
rawContentState
|
|
161
168
|
} = data;
|
|
162
169
|
const contentState = (0, _draftJs.convertFromRaw)(rawContentState);
|
|
163
|
-
const editorState = _draftJs.EditorState.createWithContent(contentState,
|
|
170
|
+
const editorState = _draftJs.EditorState.createWithContent(contentState, _index2.decorator);
|
|
164
171
|
let Component;
|
|
165
172
|
let blockRenderMap = _index.default.infoBox.default;
|
|
166
173
|
switch (type) {
|
|
@@ -182,17 +189,20 @@ function InfoBoxInArticleBody({
|
|
|
182
189
|
break;
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
|
-
return /*#__PURE__*/
|
|
186
|
-
className: className
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleBodyContainer, {
|
|
193
|
+
className: className,
|
|
194
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
195
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(EditorContainer, {
|
|
196
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_draftJs.Editor, {
|
|
197
|
+
blockRenderMap: blockRenderMap,
|
|
198
|
+
blockRendererFn: blockRendererFn,
|
|
199
|
+
editorState: editorState,
|
|
200
|
+
readOnly: true,
|
|
201
|
+
onChange: () => {}
|
|
202
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearFloat, {})]
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
});
|
|
196
206
|
}
|
|
197
207
|
function AtomicBlock(props) {
|
|
198
208
|
const entity = props.contentState.getEntity(props.block.getEntityAt(0));
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _mediaQuery = require("../utils/media-query");
|
|
8
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
8
|
var _index = require("../utils/index");
|
|
9
|
+
var _mediaQuery = require("../utils/media-query");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const mockup = {
|
|
12
12
|
mobile: {
|
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NewsReading = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
var _dropdown = require("./dropdown");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
12
|
const ArticleBodyContainer = _styledComponents.default.div`
|
|
14
13
|
max-width: 600px;
|
|
15
14
|
width: calc(280 / 320 * 100%);
|
|
@@ -43,16 +42,19 @@ const NewsReading = function ({
|
|
|
43
42
|
if (readings.length === 0) {
|
|
44
43
|
return null;
|
|
45
44
|
}
|
|
46
|
-
return /*#__PURE__*/
|
|
47
|
-
className: className
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleBodyContainer, {
|
|
46
|
+
className: className,
|
|
47
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdown.Dropdown, {
|
|
48
|
+
options: options,
|
|
49
|
+
onChange: option => setSelectedOption(option),
|
|
50
|
+
labelForMore: "\u66F4\u591A\u8A9E\u8A00"
|
|
51
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Divider, {}), (selectedReading === null || selectedReading === void 0 ? void 0 : selectedReading.embedCode) && /*#__PURE__*/(0, _jsxRuntime.jsx)(IframeContainer, {
|
|
52
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
53
|
+
dangerouslySetInnerHTML: {
|
|
54
|
+
__html: selectedReading.embedCode
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
57
59
|
};
|
|
58
60
|
exports.NewsReading = NewsReading;
|
|
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SlideshowBlock = SlideshowBlock;
|
|
7
7
|
exports.SlideshowInArticleBody = SlideshowInArticleBody;
|
|
8
|
-
var
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _react = require("react");
|
|
10
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
10
|
var _index = require("../utils/index");
|
|
12
11
|
var _mediaQuery = require("../utils/media-query");
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
var _multimedia = _interopRequireDefault(require("./multimedia"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
15
|
const mockup = {
|
|
17
16
|
mobile: {
|
|
@@ -264,42 +263,38 @@ const SlidesFlexBox = _styledComponents.default.div`
|
|
|
264
263
|
flex-wrap: nowrap;
|
|
265
264
|
width: 100%;
|
|
266
265
|
height: 100%;
|
|
267
|
-
${
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
266
|
+
${({
|
|
267
|
+
isSliding,
|
|
268
|
+
duration
|
|
269
|
+
}) => isSliding ? `transition: transform ${duration}ms ease-in-out;` : ''}
|
|
270
|
+
|
|
271
|
+
${({
|
|
272
|
+
translateXUint
|
|
273
|
+
}) => `
|
|
274
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
275
|
+
transform: translateX(
|
|
276
|
+
${getTranslateX(mockup.mobile, translateXUint) / getContainerWidth(mockup.mobile)} * 100%
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
280
|
+
transform: translateX(
|
|
281
|
+
${getTranslateX(mockup.desktop, translateXUint) / getContainerWidth(mockup.desktop)} * 100%
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
285
|
+
transform: translateX(
|
|
286
|
+
${getTranslateX(mockup.hd, translateXUint) / getContainerWidth(mockup.hd)} * 100%
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
`}
|
|
290
290
|
`;
|
|
291
291
|
const SlideFlexItem = _styledComponents.default.div`
|
|
292
292
|
height: 100%;
|
|
293
293
|
flex-shrink: 0;
|
|
294
294
|
|
|
295
295
|
${_mediaQuery.mediaQuery.smallOnly} {
|
|
296
|
-
flex-basis: calc(
|
|
297
|
-
|
|
298
|
-
);
|
|
299
|
-
padding-right: calc(
|
|
300
|
-
${mockup.mobile.slide.paddingRight} /
|
|
301
|
-
${getContainerWidth(mockup.mobile)}*100%
|
|
302
|
-
);
|
|
296
|
+
flex-basis: ${() => `calc(${getSlideWidth(mockup.mobile)} / ${getContainerWidth(mockup.mobile)}*100%)`};
|
|
297
|
+
padding-right: ${() => `calc(${mockup.mobile.slide.paddingRight} / ${getContainerWidth(mockup.mobile)}*100%)`};
|
|
303
298
|
}
|
|
304
299
|
|
|
305
300
|
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
@@ -419,20 +414,21 @@ function SlideshowBlock({
|
|
|
419
414
|
/*#__PURE__*/
|
|
420
415
|
// since the items of _images would have the same id,
|
|
421
416
|
// hence, we append `index` on the key
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
417
|
+
(0, _jsxRuntime.jsx)(SlideFlexItem, {
|
|
418
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
419
|
+
className: "w-full h-full relative overflow-hidden",
|
|
420
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
421
|
+
srcSet: imgSrcSetArr.join(','),
|
|
422
|
+
src: imgSrc,
|
|
423
|
+
style: {
|
|
424
|
+
display: 'block',
|
|
425
|
+
objectFit,
|
|
426
|
+
height: '100%'
|
|
427
|
+
},
|
|
428
|
+
sizes: "(max-width: 768px) 100vw, (min-width: 1400px) 1000px, 500px"
|
|
429
|
+
})
|
|
430
|
+
})
|
|
431
|
+
}, `slide_${img.id}_${index}`)
|
|
436
432
|
);
|
|
437
433
|
});
|
|
438
434
|
}, [images]);
|
|
@@ -467,40 +463,58 @@ function SlideshowBlock({
|
|
|
467
463
|
}, duration * 2);
|
|
468
464
|
}, [slideTo, curSlideIndex, translateXUnit]);
|
|
469
465
|
const isSliding = slideTo !== '';
|
|
470
|
-
return /*#__PURE__*/
|
|
471
|
-
className: appendedClassName
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
466
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(SlideshowFlexBox, {
|
|
467
|
+
className: appendedClassName,
|
|
468
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SlidesSection, {
|
|
469
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SlidesFlexBox, {
|
|
470
|
+
translateXUint: translateXUnit,
|
|
471
|
+
duration: duration,
|
|
472
|
+
isSliding: isSliding,
|
|
473
|
+
children: slides
|
|
474
|
+
})
|
|
475
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(PrevNextSection, {
|
|
476
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PrevButton, {
|
|
477
|
+
onClick: isSliding ? undefined : slideToPrev,
|
|
478
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PreArrowSvg, {})
|
|
479
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(NextButton, {
|
|
480
|
+
onClick: isSliding ? undefined : slideToNext,
|
|
481
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NextArrowSvg, {})
|
|
482
|
+
})]
|
|
483
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ImageNumberCircle, {
|
|
484
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ImageNumber, {
|
|
485
|
+
children: curSlideIndex + 1
|
|
486
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageTotal, {
|
|
487
|
+
children: total
|
|
488
|
+
})]
|
|
489
|
+
}), desc ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Desc, {
|
|
490
|
+
children: desc
|
|
491
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyDesc, {})]
|
|
492
|
+
});
|
|
481
493
|
}
|
|
482
494
|
function NextArrowSvg() {
|
|
483
|
-
return /*#__PURE__*/
|
|
495
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
484
496
|
viewBox: "0 0 31 17",
|
|
485
497
|
width: "31",
|
|
486
498
|
height: "17",
|
|
487
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
499
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
500
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
501
|
+
d: "M29.33 7.854H0v1h29.256l-7.11 7.148.708.705 8-8.042-.001-.707-8-7.958-.706.709 7.183 7.145z",
|
|
502
|
+
fill: "gray",
|
|
503
|
+
fillRule: "nonzero"
|
|
504
|
+
})
|
|
505
|
+
});
|
|
493
506
|
}
|
|
494
507
|
function PreArrowSvg() {
|
|
495
|
-
return /*#__PURE__*/
|
|
508
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
496
509
|
viewBox: "0 0 31 17",
|
|
497
510
|
width: "31",
|
|
498
511
|
height: "17",
|
|
499
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
512
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
513
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
514
|
+
d: "M2.17 8.5H31.5v1H2.244l7.11 7.147-.708.706-8-8.042.001-.707 8-7.958.706.708L2.17 8.5z",
|
|
515
|
+
fill: "gray"
|
|
516
|
+
})
|
|
517
|
+
});
|
|
504
518
|
}
|
|
505
519
|
const ArticleBodyContainer = _styledComponents.default.div`
|
|
506
520
|
margin: 0 auto 27px auto;
|
|
@@ -509,9 +523,10 @@ function SlideshowInArticleBody({
|
|
|
509
523
|
className = '',
|
|
510
524
|
data
|
|
511
525
|
}) {
|
|
512
|
-
return /*#__PURE__*/
|
|
513
|
-
className: className
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
526
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleBodyContainer, {
|
|
527
|
+
className: className,
|
|
528
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SlideshowBlock, {
|
|
529
|
+
data: data
|
|
530
|
+
})
|
|
531
|
+
});
|
|
517
532
|
}
|