@mjhls/mjh-framework 1.0.718 → 1.0.719

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mjh-framework v. 1.0.718
1
+ # mjh-framework v. 1.0.719
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/mjh-framework.svg)](https://www.npmjs.com/package/mjh-framework) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4
4
 
package/dist/cjs/View.js CHANGED
@@ -266,7 +266,8 @@ styleInject_es.styleInject(css);
266
266
 
267
267
  var RelatedArticle = function RelatedArticle(_ref) {
268
268
  var articles = _ref.articles,
269
- client = _ref.client;
269
+ client = _ref.client,
270
+ fallbackImage = _ref.fallbackImage;
270
271
 
271
272
  if (!articles || articles.length == 0 || !articles[0]) {
272
273
  return null;
@@ -281,11 +282,15 @@ var RelatedArticle = function RelatedArticle(_ref) {
281
282
  React__default['default'].createElement(
282
283
  'a',
283
284
  { className: styles.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
284
- article.thumbnail && React__default['default'].createElement('img', {
285
+ article.thumbnail ? React__default['default'].createElement('img', {
285
286
  style: { objectFit: 'cover', objectPosition: 'center' },
286
287
  src: article.thumbnail && urlFor(client, article.thumbnail.asset).width(250).url(),
287
288
  alt: article.title
288
- })
289
+ }) : React__default['default'].createElement(
290
+ React__default['default'].Fragment,
291
+ null,
292
+ fallbackImage && React__default['default'].createElement('img', { src: fallbackImage, alt: 'website logo', style: { objectFit: 'contain' } })
293
+ )
289
294
  ),
290
295
  React__default['default'].createElement(
291
296
  'div',
@@ -518,7 +523,10 @@ var Article = function Article(props) {
518
523
  });
519
524
  }
520
525
  if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
521
- relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: '/publications/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
526
+ var _props$Settings$issue = props.Settings.issueMapping,
527
+ issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
528
+
529
+ relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: issueMapping + '/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
522
530
  }
523
531
  if (relatedLinks && relatedLinks.length > 0) {
524
532
  return React__default['default'].createElement(
@@ -564,7 +572,7 @@ var Article = function Article(props) {
564
572
  React__default['default'].createElement(
565
573
  'div',
566
574
  { className: 'pt-2' },
567
- React__default['default'].createElement(RelatedArticle, { articles: article.relatedArticle, client: client })
575
+ React__default['default'].createElement(RelatedArticle, { articles: article.relatedArticle, client: client, fallbackImage: props.Settings.logo })
568
576
  )
569
577
  );
570
578
  };
package/dist/esm/View.js CHANGED
@@ -256,7 +256,8 @@ styleInject(css);
256
256
 
257
257
  var RelatedArticle = function RelatedArticle(_ref) {
258
258
  var articles = _ref.articles,
259
- client = _ref.client;
259
+ client = _ref.client,
260
+ fallbackImage = _ref.fallbackImage;
260
261
 
261
262
  if (!articles || articles.length == 0 || !articles[0]) {
262
263
  return null;
@@ -271,11 +272,15 @@ var RelatedArticle = function RelatedArticle(_ref) {
271
272
  React.createElement(
272
273
  'a',
273
274
  { className: styles.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
274
- article.thumbnail && React.createElement('img', {
275
+ article.thumbnail ? React.createElement('img', {
275
276
  style: { objectFit: 'cover', objectPosition: 'center' },
276
277
  src: article.thumbnail && urlFor(client, article.thumbnail.asset).width(250).url(),
277
278
  alt: article.title
278
- })
279
+ }) : React.createElement(
280
+ React.Fragment,
281
+ null,
282
+ fallbackImage && React.createElement('img', { src: fallbackImage, alt: 'website logo', style: { objectFit: 'contain' } })
283
+ )
279
284
  ),
280
285
  React.createElement(
281
286
  'div',
@@ -508,7 +513,10 @@ var Article = function Article(props) {
508
513
  });
509
514
  }
510
515
  if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
511
- relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: '/publications/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
516
+ var _props$Settings$issue = props.Settings.issueMapping,
517
+ issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
518
+
519
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: issueMapping + '/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
512
520
  }
513
521
  if (relatedLinks && relatedLinks.length > 0) {
514
522
  return React.createElement(
@@ -554,7 +562,7 @@ var Article = function Article(props) {
554
562
  React.createElement(
555
563
  'div',
556
564
  { className: 'pt-2' },
557
- React.createElement(RelatedArticle, { articles: article.relatedArticle, client: client })
565
+ React.createElement(RelatedArticle, { articles: article.relatedArticle, client: client, fallbackImage: props.Settings.logo })
558
566
  )
559
567
  );
560
568
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.718",
3
+ "version": "1.0.719",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",