@kids-reporter/draft-renderer 0.4.8 → 0.4.9

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.
@@ -14,30 +14,26 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  // @ts-ignore pkg does not contain ts header file
16
16
 
17
- const ParagraphBlock = _styledComponents.default.div`
17
+ const Paragraph = _styledComponents.default.div`
18
18
  width: 100%;
19
19
  max-width: 700px;
20
- margin: 0 auto 27px auto;
21
20
  font-size: 18px;
22
21
  font-weight: 500;
23
22
  color: #3a4f66;
24
23
  letter-spacing: 0.9px;
25
24
  line-height: 2;
25
+ margin: 0 auto;
26
26
 
27
27
  ${_mediaQuery.default.mobileOnly`
28
28
  padding-left: 15px;
29
29
  padding-right: 15px;
30
30
  `}
31
+
32
+ > div[data-block="true"] {
33
+ margin-bottom: 27px;
34
+ }
31
35
  `;
32
- function Paragraph({
33
- className,
34
- children
35
- }) {
36
- return /*#__PURE__*/_react.default.createElement(ParagraphBlock, {
37
- className: className
38
- }, children);
39
- }
40
- const HeadingBlock = _styledComponents.default.div`
36
+ const Heading = _styledComponents.default.div`
41
37
  font-weight: 700;
42
38
  line-height: 1.5;
43
39
  color: #232323;
@@ -73,15 +69,7 @@ const HeadingBlock = _styledComponents.default.div`
73
69
  padding-right: 15px;
74
70
  `}
75
71
  `;
76
- function Heading({
77
- className,
78
- children
79
- }) {
80
- return /*#__PURE__*/_react.default.createElement(HeadingBlock, {
81
- className: className
82
- }, children);
83
- }
84
- const ListBlock = _styledComponents.default.ol`
72
+ const List = _styledComponents.default.ol`
85
73
  width: 100%;
86
74
  max-width: 700px;
87
75
  margin: 0 auto 27px auto;
@@ -94,26 +82,16 @@ const ListBlock = _styledComponents.default.ol`
94
82
  margin-bottom: 6px;
95
83
  }
96
84
  `;
97
- function OrderdedList({
98
- children,
99
- className
100
- }) {
101
- return /*#__PURE__*/_react.default.createElement(ListBlock, {
102
- className: className
103
- }, children);
104
- }
105
- function UnorderdedList({
106
- children,
107
- className
108
- }) {
109
- return /*#__PURE__*/_react.default.createElement(ListBlock, {
110
- as: "ul",
111
- className: className
112
- }, children);
113
- }
85
+ const Atomic = _styledComponents.default.div`
86
+ /* hide empty block which immediately follows atomic block */
87
+ & + ${Paragraph} {
88
+ display: none;
89
+ }
90
+ `;
114
91
  const _blockRenderMap = _immutable.default.Map({
115
92
  atomic: {
116
- element: 'div'
93
+ element: 'div',
94
+ wrapper: /*#__PURE__*/_react.default.createElement(Atomic, null)
117
95
  },
118
96
  'header-two': {
119
97
  element: 'h2',
@@ -133,11 +111,13 @@ const _blockRenderMap = _immutable.default.Map({
133
111
  },
134
112
  'ordered-list-item': {
135
113
  element: 'li',
136
- wrapper: /*#__PURE__*/_react.default.createElement(OrderdedList, null)
114
+ wrapper: /*#__PURE__*/_react.default.createElement(List, null)
137
115
  },
138
116
  'unordered-list-item': {
139
117
  element: 'li',
140
- wrapper: /*#__PURE__*/_react.default.createElement(UnorderdedList, null)
118
+ wrapper: /*#__PURE__*/_react.default.createElement(List, {
119
+ as: "ul"
120
+ })
141
121
  },
142
122
  unstyled: {
143
123
  element: 'div',
@@ -149,20 +129,19 @@ exports.blockRenderMap = blockRenderMap;
149
129
  const ParagraphForIntroduction = (0, _styledComponents.default)(Paragraph)`
150
130
  color: #575757;
151
131
  `;
152
- const OrderdedListForIntroduction = (0, _styledComponents.default)(OrderdedList)`
153
- color: #575757;
154
- `;
155
- const UnorderdedListForIntroduction = (0, _styledComponents.default)(UnorderdedList)`
132
+ const ListForIntroduction = (0, _styledComponents.default)(List)`
156
133
  color: #575757;
157
134
  `;
158
135
  const blockRenderMapForIntroduction = _draftJs.DefaultDraftBlockRenderMap.merge(_immutable.default.Map({
159
136
  'ordered-list-item': {
160
137
  element: 'li',
161
- wrapper: /*#__PURE__*/_react.default.createElement(OrderdedListForIntroduction, null)
138
+ wrapper: /*#__PURE__*/_react.default.createElement(ListForIntroduction, null)
162
139
  },
163
140
  'unordered-list-item': {
164
141
  element: 'li',
165
- wrapper: /*#__PURE__*/_react.default.createElement(UnorderdedListForIntroduction, null)
142
+ wrapper: /*#__PURE__*/_react.default.createElement(ListForIntroduction, {
143
+ as: "ul"
144
+ })
166
145
  },
167
146
  unstyled: {
168
147
  element: 'div',
@@ -173,12 +152,7 @@ exports.blockRenderMapForIntroduction = blockRenderMapForIntroduction;
173
152
  const HeadingForAnnotation = (0, _styledComponents.default)(Heading)`
174
153
  margin: 0 auto 27px auto;
175
154
  `;
176
- const OrderdedListForAnnotation = (0, _styledComponents.default)(OrderdedList)`
177
- li {
178
- font-size: 16px;
179
- }
180
- `;
181
- const UnorderdedListForAnnotation = (0, _styledComponents.default)(UnorderdedList)`
155
+ const ListForAnnotation = (0, _styledComponents.default)(List)`
182
156
  li {
183
157
  font-size: 16px;
184
158
  }
@@ -203,11 +177,13 @@ const _blockRenderMapForAnnotation = _immutable.default.Map({
203
177
  },
204
178
  'ordered-list-item': {
205
179
  element: 'li',
206
- wrapper: /*#__PURE__*/_react.default.createElement(OrderdedListForAnnotation, null)
180
+ wrapper: /*#__PURE__*/_react.default.createElement(ListForAnnotation, null)
207
181
  },
208
182
  'unordered-list-item': {
209
183
  element: 'li',
210
- wrapper: /*#__PURE__*/_react.default.createElement(UnorderdedListForAnnotation, null)
184
+ wrapper: /*#__PURE__*/_react.default.createElement(ListForAnnotation, {
185
+ as: "ul"
186
+ })
211
187
  },
212
188
  unstyled: {
213
189
  element: 'div',
@@ -59,12 +59,6 @@ const ArticleBodyContainer = _styledComponents.default.div`
59
59
  margin: 0;
60
60
  }
61
61
 
62
- &::after {
63
- content: '';
64
- display: table;
65
- clear: both;
66
- }
67
-
68
62
  max-width: 100%;
69
63
  margin: 0 auto 27px auto;
70
64
 
@@ -81,31 +75,23 @@ const ArticleBodyContainer = _styledComponents.default.div`
81
75
  case 'paragraph-width':
82
76
  return `
83
77
  ${_index.theme.breakpoint.xl} {
84
- figure {
85
- width: 700px;
86
- margin-left: auto;
87
- margin-right: auto;
88
- }
78
+ max-width: 700px;
89
79
  }
90
80
  `;
91
81
  case 'right':
92
82
  return `
93
83
  ${_index.theme.breakpoint.xl} {
94
- figure {
95
- width: 361px;
96
- float: right;
97
- margin: 5px 0px 5px 27px;
98
- }
84
+ width: 361px;
85
+ float: right;
86
+ margin: 5px 0px 5px 27px;
99
87
  }
100
88
  `;
101
89
  case 'left':
102
90
  return `
103
91
  ${_index.theme.breakpoint.xl} {
104
- figure {
105
- width: 361px;
106
- float: left;
107
- margin: 5px 27px 5px 0px;
108
- }
92
+ width: 361px;
93
+ float: left;
94
+ margin: 5px 27px 5px 0px;
109
95
  }
110
96
  `;
111
97
  }
@@ -130,40 +116,15 @@ const InfoBoxContainer = _styledComponents.default.div`
130
116
  margin-bottom: 30px;
131
117
  width: fit-content;
132
118
 
133
- &::after {
134
- content: '';
135
- display: table;
136
- clear: both;
137
- }
138
-
139
119
  ${props => {
140
120
  switch (props.$alignment) {
141
- case 'paragraph-width':
142
- {
143
- return `
144
- figure {
145
- margin-left: auto;
146
- margin-right: auto;
147
- }
148
- `;
149
- }
150
- case 'left':
121
+ case 'center':
151
122
  {
152
- return `
153
- figure {
154
- max-width: 50%;
155
- margin-right: auto;
156
- }
157
- `;
123
+ return `margin-left: auto; margin-right: auto;`;
158
124
  }
159
125
  case 'right':
160
126
  {
161
- return `
162
- figure {
163
- max-width: 50%;
164
- margin-left: auto;
165
- }
166
- `;
127
+ return `margin-left: auto`;
167
128
  }
168
129
  }
169
130
  }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kids-reporter/draft-renderer",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {