@urbanos/react-discovery-ui 2.1.62 → 2.1.63

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.
@@ -30,14 +30,16 @@ var DataCard = function DataCard(props) {
30
30
  });
31
31
  };
32
32
  var dataset = props.dataset;
33
- var _useState = (0, _react.useState)('loading'),
33
+ var _useState = (0, _react.useState)(null),
34
34
  _useState2 = _slicedToArray(_useState, 2),
35
- imageStatus = _useState2[0],
36
- setImageStatus = _useState2[1];
37
- var logoAltText = function logoAltText() {
38
- if (imageStatus === 'fallback') return "No image available for ".concat(dataset.organization_title);
35
+ failedImageUrl = _useState2[0],
36
+ setFailedImageUrl = _useState2[1];
37
+ var logoAltText = function () {
38
+ if (failedImageUrl === dataset.organization_image_url) {
39
+ return "No image available for ".concat(dataset.organization_title);
40
+ }
39
41
  return "The logo for ".concat(dataset.organization_title);
40
- };
42
+ }();
41
43
  var truncatedDescription = truncateDescription(dataset.description, maxDescriptionLength);
42
44
  return /*#__PURE__*/React.createElement("data-card", null, /*#__PURE__*/React.createElement("div", {
43
45
  className: "logo"
@@ -47,9 +49,9 @@ var DataCard = function DataCard(props) {
47
49
  src: dataset.organization_image_url,
48
50
  fallbackImage: _no_image.default,
49
51
  initialImage: /*#__PURE__*/React.createElement(_loadingElement.default, null),
50
- alt: logoAltText(imageStatus, dataset),
51
- onError: function onError(errorUrl) {
52
- if (errorUrl === dataset.organization_image_url) setImageStatus('fallback');
52
+ alt: logoAltText,
53
+ onError: function onError() {
54
+ return setFailedImageUrl(dataset.organization_image_url);
53
55
  }
54
56
  }))), /*#__PURE__*/React.createElement("div", {
55
57
  className: "details"
@@ -47,6 +47,14 @@ describe('data card element with logo', () => {
47
47
  expect(subject.find(ReactImageFallback).prop('alt')).toEqual('The logo for Organization Title')
48
48
  expect(subject.find(ReactImageFallback).prop('src')).toEqual(dataset.organization_image_url)
49
49
  })
50
+
51
+ test('card to render fallback alt text when image fails to load', () => {
52
+ subject.find(ReactImageFallback).prop('onError')()
53
+
54
+ expect(subject.find(ReactImageFallback).prop('alt')).toEqual(
55
+ 'No image available for Organization Title'
56
+ )
57
+ })
50
58
  })
51
59
 
52
60
  describe('data card element with html description', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urbanos/react-discovery-ui",
3
- "version": "2.1.62",
3
+ "version": "2.1.63",
4
4
  "description": "React component for dataset discovery UI",
5
5
  "main": "./lib/ReactDiscoveryUI.js",
6
6
  "repository": {
@@ -35,9 +35,11 @@
35
35
  "leaflet": "^1.9.4",
36
36
  "lodash": "^4.17.21",
37
37
  "luxon": "^2.5.2",
38
+ "maplibre-gl": "^6.10.0",
38
39
  "minimist": "^1.2.8",
39
40
  "node-fetch": "^3.3.2",
40
41
  "normalize.css": "^8.0.1",
42
+ "plotly.js": "^2.27.0",
41
43
  "prismjs": "^1.29.0",
42
44
  "prop-types": "^15.8.1",
43
45
  "qs": "^6.14.0",