@kids-reporter/draft-renderer 0.4.9 → 0.4.12

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.
@@ -36,7 +36,6 @@ const DropdownOption = _styledComponents.default.li`
36
36
  const Container = _styledComponents.default.div`
37
37
  width: 100%;
38
38
  overflow: hidden;
39
- cursor: pointer;
40
39
 
41
40
  font-size: 18px;
42
41
  font-weight: 400;
@@ -54,13 +53,14 @@ const Input = _styledComponents.default.input`
54
53
  padding: 12px 0;
55
54
  outline: none;
56
55
  border: none;
57
- cursor: pointer;
58
56
  `;
59
- const More = _styledComponents.default.span`
57
+ const Label = _styledComponents.default.span`
60
58
  margin-left: 10px;
61
59
  font-size: 14px;
60
+ cursor: pointer;
62
61
  `;
63
62
  const Arrow = _styledComponents.default.span`
63
+ cursor: pointer;
64
64
  margin-left: auto;
65
65
 
66
66
  width: 20px;
@@ -93,6 +93,9 @@ const Dropdown = function ({
93
93
  const [isListOpen, setIsListOpen] = (0, _react.useState)(false);
94
94
  const [selectedOption, setSelectedOption] = (0, _react.useState)(options === null || options === void 0 ? void 0 : options[0]);
95
95
  const toggleList = () => {
96
+ if (options.length <= 1) {
97
+ return;
98
+ }
96
99
  setIsListOpen(!isListOpen);
97
100
  };
98
101
  const selectOption = option => {
@@ -115,6 +118,6 @@ const Dropdown = function ({
115
118
  value: selectedOption.name
116
119
  }), options.length > 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Arrow, {
117
120
  $isListOpen: isListOpen
118
- }), labelForMore && /*#__PURE__*/_react.default.createElement(More, null, labelForMore))), isListOpen && /*#__PURE__*/_react.default.createElement(DropdownOptionList, null, optionItem));
121
+ }), labelForMore && /*#__PURE__*/_react.default.createElement(Label, null, labelForMore))), isListOpen && /*#__PURE__*/_react.default.createElement(DropdownOptionList, null, optionItem));
119
122
  };
120
123
  exports.Dropdown = Dropdown;
@@ -40,6 +40,9 @@ const NewsReading = function ({
40
40
  }), [readings]);
41
41
  const [selectedOption, setSelectedOption] = (0, _react.useState)(options[0]);
42
42
  const selectedReading = readings.find(r => r.name === selectedOption.value);
43
+ if (readings.length === 0) {
44
+ return null;
45
+ }
43
46
  return /*#__PURE__*/_react.default.createElement(ArticleBodyContainer, {
44
47
  className: className
45
48
  }, /*#__PURE__*/_react.default.createElement(_dropdown.Dropdown, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kids-reporter/draft-renderer",
3
- "version": "0.4.9",
3
+ "version": "0.4.12",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {