@kids-reporter/draft-renderer 0.1.0 → 0.2.1
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-map.js +183 -0
- package/lib/block-renderer-fn.js +16 -75
- package/lib/block-renderers/embedded-code-block.js +33 -21
- package/lib/block-renderers/image-block.js +90 -46
- package/lib/block-renderers/index.js +3 -31
- package/lib/block-renderers/info-box-block.js +2 -115
- package/lib/block-renderers/multimedia.js +127 -0
- package/lib/block-renderers/slideshow-block.js +574 -199
- package/lib/draft-renderer.js +10 -194
- package/lib/entity-decorators/annotation-decorator.js +58 -100
- package/lib/entity-decorators/index.js +17 -6
- package/lib/entity-decorators/link-decorator.js +4 -7
- package/lib/index.js +39 -14
- package/lib/theme/index.js +0 -11
- package/package.json +10 -6
- package/lib/assets/annotation-arrow.png +0 -0
- package/lib/assets/audio-pause.png +0 -0
- package/lib/assets/audio-play.png +0 -0
- package/lib/assets/citation-download.png +0 -0
- package/lib/assets/default-og-img.png +0 -0
- package/lib/assets/slideshow-arrow-down-dark.png +0 -0
- package/lib/assets/slideshow-arrow-down.png +0 -0
- package/lib/assets/slideshow-arrow-up.png +0 -0
- package/lib/assets/slideshow-close-cross.png +0 -0
- package/lib/block-renderers/audio-block.js +0 -162
- package/lib/block-renderers/background-image-block.js +0 -257
- package/lib/block-renderers/background-video-block.js +0 -272
- package/lib/block-renderers/color-box-block.js +0 -94
- package/lib/block-renderers/divider-block.js +0 -27
- package/lib/block-renderers/media-block.js +0 -65
- package/lib/block-renderers/related-post-block.js +0 -73
- package/lib/block-renderers/side-index-block.js +0 -49
- package/lib/block-renderers/table-block.js +0 -455
- package/lib/block-renderers/video-block.js +0 -37
- package/lib/components/slideshow-lightbox.js +0 -134
- package/lib/components/slideshow-sidebar.js +0 -148
- package/lib/const.js +0 -10
- package/lib/entity-decorator.js +0 -18
- package/lib/public/07d1287fd390346af0c15b930148a5e4.png +0 -0
- package/lib/public/5b3cb1a908786c8750f1041860699cc1.png +0 -0
- package/lib/public/679d63b1846e81ada28c2f76edbd2931.png +0 -0
- package/lib/public/722f90c535fa64c27555ec6ee5f22393.png +0 -0
- package/lib/public/903cf84ef5c5ad76634c30bdc0ff8c49.png +0 -0
- package/lib/public/dc249b3412c5af890a004508287a3c3d.png +0 -0
- package/lib/public/dd45f0788d9c70cabe72430bf08e7413.png +0 -0
- package/lib/public/f96d4b486ba2061c460962ae694f4670.png +0 -0
- package/lib/shared-style/content-type.js +0 -163
- package/lib/shared-style/index.js +0 -108
- package/lib/types/index.js +0 -32
- package/lib/utils/common.js +0 -44
- package/lib/utils/post.js +0 -147
|
@@ -5,120 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.InfoBoxBlock = InfoBoxBlock;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
|
-
var _sharedStyle = require("../shared-style");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
const infoboxDefaultSpacing = 8;
|
|
17
|
-
const InfoBoxRenderWrapper = _styledComponents.default.div`
|
|
18
|
-
background: #f6f6fb;
|
|
19
|
-
position: relative;
|
|
20
|
-
padding: 24px 0px;
|
|
21
|
-
width: calc(100% + 40px);
|
|
22
|
-
transform: translateX(-20px);
|
|
23
|
-
${({
|
|
24
|
-
theme
|
|
25
|
-
}) => theme.margin.default};
|
|
26
|
-
|
|
27
|
-
${({
|
|
28
|
-
theme
|
|
29
|
-
}) => theme.breakpoint.md} {
|
|
30
|
-
max-width: 560px;
|
|
31
|
-
transform: none;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
const InfoTitle = _styledComponents.default.div`
|
|
35
|
-
width: 100%;
|
|
36
|
-
font-style: normal;
|
|
37
|
-
font-weight: 700;
|
|
38
|
-
${({
|
|
39
|
-
theme
|
|
40
|
-
}) => theme.fontSize.md};
|
|
41
|
-
line-height: 1.5;
|
|
42
|
-
letter-spacing: 0.03em;
|
|
43
|
-
color: #000928;
|
|
44
|
-
border-left: 8px solid #04295e;
|
|
45
|
-
padding: 0 32px 0 24px;
|
|
46
|
-
margin-bottom: ${infoboxDefaultSpacing}px;
|
|
47
|
-
`;
|
|
48
|
-
const InfoContent = _styledComponents.default.div`
|
|
49
|
-
padding: 0px 32px;
|
|
50
|
-
font-style: normal;
|
|
51
|
-
font-weight: 400;
|
|
52
|
-
${({
|
|
53
|
-
theme
|
|
54
|
-
}) => theme.fontSize.sm};
|
|
55
|
-
line-height: 1.6;
|
|
56
|
-
color: rgba(0, 9, 40, 0.87);
|
|
57
|
-
|
|
58
|
-
> div > * + * {
|
|
59
|
-
margin: ${infoboxDefaultSpacing}px 0 0;
|
|
60
|
-
min-height: 0.01px; //to make margins between paragraphs effective
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
h2 {
|
|
64
|
-
${_sharedStyle.defaultH2Style}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
ul {
|
|
68
|
-
${_sharedStyle.defaultUlStyle}
|
|
69
|
-
margin-top: ${infoboxDefaultSpacing}px;
|
|
70
|
-
|
|
71
|
-
> li {
|
|
72
|
-
${_sharedStyle.defaultUnorderedListStyle}
|
|
73
|
-
|
|
74
|
-
& + li {
|
|
75
|
-
margin: ${infoboxDefaultSpacing / 2}px 0 0;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
ol {
|
|
81
|
-
${_sharedStyle.defaultOlStyle}
|
|
82
|
-
margin-top: ${infoboxDefaultSpacing}px;
|
|
83
|
-
|
|
84
|
-
> li {
|
|
85
|
-
${_sharedStyle.defaultOrderedListStyle}
|
|
86
|
-
|
|
87
|
-
& + li {
|
|
88
|
-
margin: ${infoboxDefaultSpacing / 2}px 0 0;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
a {
|
|
94
|
-
${_sharedStyle.defaultLinkStyle}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
blockquote {
|
|
98
|
-
${_sharedStyle.defaultBlockQuoteStyle}
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
|
|
8
|
+
/* eslint-disable */
|
|
102
9
|
function InfoBoxBlock(props) {
|
|
103
|
-
|
|
104
|
-
block,
|
|
105
|
-
contentState
|
|
106
|
-
} = props;
|
|
107
|
-
const entityKey = block.getEntityAt(0);
|
|
108
|
-
const entity = contentState.getEntity(entityKey);
|
|
109
|
-
const {
|
|
110
|
-
title,
|
|
111
|
-
body
|
|
112
|
-
} = entity.getData();
|
|
113
|
-
return /*#__PURE__*/_react.default.createElement(InfoBoxRenderWrapper, {
|
|
114
|
-
className: "infobox-wrapper"
|
|
115
|
-
}, /*#__PURE__*/_react.default.createElement(InfoTitle, {
|
|
116
|
-
className: "infobox-title"
|
|
117
|
-
}, title), /*#__PURE__*/_react.default.createElement(InfoContent, {
|
|
118
|
-
className: "infobox-content"
|
|
119
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
-
dangerouslySetInnerHTML: {
|
|
121
|
-
__html: body
|
|
122
|
-
}
|
|
123
|
-
})));
|
|
10
|
+
return null;
|
|
124
11
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
9
|
+
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// @ts-ignore @twreporter/core does not provide ts header file
|
|
15
|
+
const mockup = {
|
|
16
|
+
mobile: {
|
|
17
|
+
figure: {
|
|
18
|
+
width: '100%'
|
|
19
|
+
},
|
|
20
|
+
caption: {
|
|
21
|
+
width: 250 // px
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
tablet: {
|
|
26
|
+
figure: {
|
|
27
|
+
width: '100%'
|
|
28
|
+
},
|
|
29
|
+
caption: {
|
|
30
|
+
width: 512 // px
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
desktop: {
|
|
35
|
+
figure: {
|
|
36
|
+
width: {
|
|
37
|
+
normal: 100,
|
|
38
|
+
// %
|
|
39
|
+
small: 403 // px
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
caption: {
|
|
44
|
+
width: 180 // px
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
hd: {
|
|
49
|
+
figure: {
|
|
50
|
+
width: {
|
|
51
|
+
normal: 100,
|
|
52
|
+
// %
|
|
53
|
+
small: 532 // px
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
caption: {
|
|
58
|
+
width: 265 // px
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const Caption = _styledComponents.default.figcaption`
|
|
64
|
+
color: #494949;
|
|
65
|
+
&::after {
|
|
66
|
+
border-color: #d0a67d;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
line-height: 1.36;
|
|
70
|
+
letter-spacing: 0.5px;
|
|
71
|
+
font-weight: normal;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
margin-bottom: 30px;
|
|
74
|
+
|
|
75
|
+
/* border-bottom of caption */
|
|
76
|
+
&::after {
|
|
77
|
+
content: '';
|
|
78
|
+
height: 1px;
|
|
79
|
+
position: absolute;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
border-width: 0 0 1px 0;
|
|
83
|
+
border-style: solid;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
${_mediaQuery.default.tabletAndBelow`
|
|
87
|
+
position: relative;
|
|
88
|
+
margin-left: auto;
|
|
89
|
+
padding: 15px 15px 15px 0;
|
|
90
|
+
&:after {
|
|
91
|
+
width: calc(100% - 15px);
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
94
|
+
|
|
95
|
+
${_mediaQuery.default.mobileOnly`
|
|
96
|
+
max-width: ${mockup.mobile.caption.width}px;
|
|
97
|
+
`}
|
|
98
|
+
|
|
99
|
+
${_mediaQuery.default.tabletOnly`
|
|
100
|
+
max-width: ${mockup.tablet.caption.width}px;
|
|
101
|
+
`}
|
|
102
|
+
|
|
103
|
+
${_mediaQuery.default.desktopAndAbove`
|
|
104
|
+
/* clear float */
|
|
105
|
+
clear: both;
|
|
106
|
+
|
|
107
|
+
position: relative;
|
|
108
|
+
float: right;
|
|
109
|
+
|
|
110
|
+
&:after {
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
`}
|
|
114
|
+
|
|
115
|
+
${_mediaQuery.default.desktopOnly`
|
|
116
|
+
width: ${mockup.desktop.caption.width}px;
|
|
117
|
+
padding: 15px 0 15px 0;
|
|
118
|
+
`}
|
|
119
|
+
${_mediaQuery.default.hdOnly`
|
|
120
|
+
width: ${mockup.hd.caption.width}px;
|
|
121
|
+
padding: 25px 0 20px 0;
|
|
122
|
+
`}
|
|
123
|
+
`;
|
|
124
|
+
var _default = {
|
|
125
|
+
Caption
|
|
126
|
+
};
|
|
127
|
+
exports.default = _default;
|