@mjhls/mjh-framework 1.0.170 → 1.0.172

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/dist/index.js CHANGED
@@ -7,7 +7,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7
7
  var React = require('react');
8
8
  var React__default = _interopDefault(React);
9
9
  var PropTypes = _interopDefault(require('prop-types'));
10
- var require$$1 = _interopDefault(require('react-dom'));
10
+ var reactDom = _interopDefault(require('react-dom'));
11
11
  var Container = _interopDefault(require('react-bootstrap/Container'));
12
12
  var Row = _interopDefault(require('react-bootstrap/Row'));
13
13
  var Col = _interopDefault(require('react-bootstrap/Col'));
@@ -7185,7 +7185,7 @@ var InfiniteScroll = /** @class */ (function (_super) {
7185
7185
 
7186
7186
  var visibilitySensor = createCommonjsModule(function (module, exports) {
7187
7187
  (function webpackUniversalModuleDefinition(root, factory) {
7188
- module.exports = factory(React__default, require$$1);
7188
+ module.exports = factory(React__default, reactDom);
7189
7189
  })(commonjsGlobal, function(__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__) {
7190
7190
  return /******/ (function(modules) { // webpackBootstrap
7191
7191
  /******/ // The module cache
@@ -8485,7 +8485,7 @@ var _react2 = _interopRequireDefault(React__default);
8485
8485
 
8486
8486
 
8487
8487
 
8488
- var _reactDom2 = _interopRequireDefault(require$$1);
8488
+ var _reactDom2 = _interopRequireDefault(reactDom);
8489
8489
 
8490
8490
 
8491
8491
 
@@ -14050,55 +14050,68 @@ var IssueDeck = function IssueDeck(props) {
14050
14050
  Col,
14051
14051
  { md: 12, lg: 12, key: index },
14052
14052
  React__default.createElement(
14053
- Link,
14054
- { href: href + '/' + publication + '/' + row.identifier.current },
14053
+ Card,
14054
+ { className: 'queue-card journal-queue', style: { borderTop: '1px solid #EEE' } },
14055
14055
  React__default.createElement(
14056
- 'a',
14057
- null,
14056
+ Row,
14057
+ { style: { flexDirection: 'left' } },
14058
14058
  React__default.createElement(
14059
- Card,
14060
- { className: 'queue-card journal-queue', style: { borderTop: '1px solid #EEE' } },
14059
+ Link,
14060
+ { href: href + '/' + publication + '/' + row.identifier.current },
14061
14061
  React__default.createElement(
14062
- Row,
14063
- { style: { flexDirection: 'left' } },
14062
+ 'a',
14063
+ null,
14064
14064
  React__default.createElement(
14065
14065
  Col,
14066
- { md: 12, lg: 4 },
14066
+ { md: 12, lg: 4, className: 'body-image' },
14067
14067
  row.thumbnail && React__default.createElement(
14068
14068
  LazyLoad,
14069
14069
  { height: imageHeight },
14070
14070
  React__default.createElement(Card.Img, { variant: 'top', src: renderCardImage(row.thumbnail), alt: row.name })
14071
14071
  )
14072
+ )
14073
+ )
14074
+ ),
14075
+ React__default.createElement(
14076
+ Col,
14077
+ null,
14078
+ React__default.createElement(
14079
+ Card.Body,
14080
+ { style: { padding: '20px' }, className: 'body-text' },
14081
+ React__default.createElement(
14082
+ Card.Title,
14083
+ null,
14084
+ row.name
14072
14085
  ),
14073
14086
  React__default.createElement(
14074
- Col,
14087
+ 'div',
14088
+ null,
14089
+ 'Volume: ',
14090
+ row.volume
14091
+ ),
14092
+ React__default.createElement(
14093
+ 'div',
14075
14094
  null,
14095
+ 'Number: ',
14096
+ row.number
14097
+ ),
14098
+ React__default.createElement(
14099
+ Link,
14100
+ { href: href + '/' + publication + '/' + row.identifier.current },
14076
14101
  React__default.createElement(
14077
- Card.Body,
14078
- { style: { padding: '20px' } },
14079
- React__default.createElement(
14080
- Card.Title,
14081
- null,
14082
- row.name
14083
- ),
14084
- React__default.createElement(
14085
- 'div',
14086
- null,
14087
- 'Volume: ',
14088
- row.volume
14089
- ),
14090
- React__default.createElement(
14091
- 'div',
14092
- null,
14093
- 'Number: ',
14094
- row.number
14095
- ),
14102
+ 'a',
14103
+ null,
14096
14104
  React__default.createElement(
14097
14105
  Button,
14098
14106
  { style: { marginTop: '20px' }, variant: 'secondary' },
14099
14107
  'View Issue'
14100
14108
  )
14101
14109
  )
14110
+ ),
14111
+ row.pdf && row.pdf.asset && React__default.createElement(
14112
+ 'a',
14113
+ { href: row.pdf.asset.url, target: '_blank', className: 'btn btn-primary', style: { marginTop: '20px', marginLeft: '1rem' } },
14114
+ 'Download Issue'
14102
14115
  )
14103
14116
  )
14104
14117
  )
@@ -14815,7 +14828,6 @@ var SideFooter = function SideFooter(props) {
14815
14828
  var logo = props.logo;
14816
14829
 
14817
14830
  var year = new Date().getFullYear();
14818
-
14819
14831
  return React__default.createElement(
14820
14832
  'div',
14821
14833
  { className: 'side-footer' },
@@ -15091,7 +15103,7 @@ var Column3 = function Column3(props) {
15091
15103
  Col,
15092
15104
  { md: true, className: 'leftCol', style: { width: '200px' } },
15093
15105
  React__default.createElement(LeftNav, { leftItems: leftItems }),
15094
- website && website.sideFooterContent && website.sideFooterContent.length && website.showFooterOnLeftSide && React__default.createElement(SideFooter, { website: website })
15106
+ website && website.sideFooterContent && website.sideFooterContent.length && website.showFooterOnLeftSide && React__default.createElement(SideFooter, { website: website, logo: logo })
15095
15107
  ),
15096
15108
  React__default.createElement(
15097
15109
  Col,
@@ -15414,7 +15426,7 @@ var NavFooter = function NavFooter(props) {
15414
15426
  { className: 'nav-link' },
15415
15427
  '\xA9 ',
15416
15428
  year,
15417
- ' ',
15429
+ ' MJH Life Sciences and ',
15418
15430
  website.title,
15419
15431
  '. All rights reserved.'
15420
15432
  )
@@ -15483,7 +15495,7 @@ var SocialNavFooter = function SocialNavFooter(props) {
15483
15495
  { className: 'nav-link' },
15484
15496
  '\xA9 ',
15485
15497
  year,
15486
- ' ',
15498
+ ' MJH Life Sciences and ',
15487
15499
  website.name,
15488
15500
  '. All rights reserved.'
15489
15501
  )
@@ -16320,7 +16332,7 @@ var HamMagazine = function HamMagazine(props) {
16320
16332
  var trackScrolling = function trackScrolling() {
16321
16333
  var offsetTop = navRef.current.getBoundingClientRect().top;
16322
16334
 
16323
- if (offsetTop === 0) {
16335
+ if (offsetTop <= 0) {
16324
16336
  setIsSticky(true);
16325
16337
  } else {
16326
16338
  setIsSticky(false);
@@ -16898,16 +16910,30 @@ var FigureComponent = function FigureComponent(_ref) {
16898
16910
  imgFloat = _useState4[0],
16899
16911
  setimgFloat = _useState4[1];
16900
16912
 
16913
+ var _useState5 = React.useState(false),
16914
+ _useState6 = slicedToArray(_useState5, 2),
16915
+ openImg = _useState6[0],
16916
+ setOpenImg = _useState6[1];
16917
+
16918
+ var _useState7 = React.useState(''),
16919
+ _useState8 = slicedToArray(_useState7, 2),
16920
+ openImgSrc = _useState8[0],
16921
+ setOpenImgSrc = _useState8[1];
16922
+
16901
16923
  var caption = node$$1.caption,
16902
16924
  alt = node$$1.alt,
16903
16925
  blank = node$$1.blank,
16904
16926
  link = node$$1.link,
16905
- _node$widthP = node$$1.widthP,
16906
- widthP = _node$widthP === undefined ? '30' : _node$widthP,
16907
16927
  _node$alignment = node$$1.alignment,
16908
16928
  alignment = _node$alignment === undefined ? 'center' : _node$alignment;
16929
+ var _node$widthP = node$$1.widthP,
16930
+ widthP = _node$widthP === undefined ? 'auto' : _node$widthP;
16909
16931
 
16910
16932
 
16933
+ if (client.clientConfig.defaultImageSize && widthP === 'auto') {
16934
+ widthP = client.clientConfig.defaultImageSize;
16935
+ }
16936
+
16911
16937
  var figureMargin = void 0;
16912
16938
  if (imgFloat === 'none') {
16913
16939
  figureMargin = '0 auto 1rem';
@@ -16944,7 +16970,7 @@ var FigureComponent = function FigureComponent(_ref) {
16944
16970
  React.useEffect(function () {
16945
16971
  var screenWidth = window.innerWidth;
16946
16972
  if (screenWidth > 1000) {
16947
- var align = alignment.toLowerCase() === 'center' ? 'none' : alignment.toLowerCase();
16973
+ var align = ['center', 'top'].includes(alignment.toLowerCase()) ? 'none' : alignment.toLowerCase();
16948
16974
  setimgFloat(align);
16949
16975
  }
16950
16976
 
@@ -16954,23 +16980,45 @@ var FigureComponent = function FigureComponent(_ref) {
16954
16980
  if (!node$$1.asset) return null;
16955
16981
 
16956
16982
  return React__default.createElement(
16957
- reactBootstrap.Figure,
16958
- { className: 'd-block', style: { width: imageWidth, maxWidth: '100%', clear: 'both', float: imgFloat, margin: figureMargin } },
16959
- link ? React__default.createElement(
16960
- 'a',
16961
- { href: link, target: blank ? '_blank' : '_self' },
16962
- React__default.createElement(reactBootstrap.Figure.Image, { style: { width: '100%' }, className: 'figure-image', ref: imgElement, onLoad: loadImg, src: urlFor$1(node$$1, client).url(), alt: alt && alt }),
16963
- caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
16964
- ) : React__default.createElement(
16965
- React__default.Fragment,
16966
- null,
16967
- React__default.createElement(reactBootstrap.Figure.Image, { style: { width: '100%' }, className: 'figure-image', ref: imgElement, onLoad: loadImg, src: urlFor$1(node$$1, client).url(), alt: alt && alt }),
16968
- caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
16983
+ React__default.Fragment,
16984
+ null,
16985
+ React__default.createElement(
16986
+ reactBootstrap.Figure,
16987
+ {
16988
+ className: 'd-block',
16989
+ style: { width: imageWidth, maxWidth: '100%', clear: 'both', float: imgFloat, margin: figureMargin },
16990
+ onClick: function onClick() {
16991
+ setOpenImgSrc(urlFor$1(node$$1, client).url());
16992
+ setOpenImg(true);
16993
+ } },
16994
+ link ? React__default.createElement(
16995
+ 'a',
16996
+ { target: blank ? '_blank' : '_self' },
16997
+ React__default.createElement(reactBootstrap.Figure.Image, { style: { width: '100%' }, className: 'figure-image', ref: imgElement, onLoad: loadImg, src: urlFor$1(node$$1, client).url(), alt: alt && alt }),
16998
+ caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
16999
+ ) : React__default.createElement(
17000
+ React__default.Fragment,
17001
+ null,
17002
+ React__default.createElement(reactBootstrap.Figure.Image, { style: { width: '100%' }, className: 'figure-image', ref: imgElement, onLoad: loadImg, src: urlFor$1(node$$1, client).url(), alt: alt && alt }),
17003
+ caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
17004
+ )
17005
+ ),
17006
+ React__default.createElement(
17007
+ 'div',
17008
+ { className: 'lightbox-target ' + (openImg ? 'open' : 'close') },
17009
+ React__default.createElement('img', { src: openImgSrc }),
17010
+ React__default.createElement('a', {
17011
+ className: 'lightbox-close',
17012
+ onClick: function onClick() {
17013
+ setOpenImgSrc('');
17014
+ setOpenImg(false);
17015
+ }
17016
+ })
16969
17017
  ),
16970
17018
  React__default.createElement(
16971
17019
  'style',
16972
17020
  { jsx: 'true' },
16973
- '\n figure-caption {\n font-size: 90%;\n color: #6c757d;\n }\n '
17021
+ '\n figure-caption {\n font-size: 90%;\n color: #6c757d;\n }\n /*Eliminates padding, centers the thumbnail */\n\n body,\n html {\n padding: 0;\n margin: 0;\n text-align: center;\n }\n\n /* Styles the lightbox, removes it from sight and adds the fade-in transition */\n\n .lightbox-target {\n position: fixed;\n top: -100%;\n width: 100%;\n background: rgba(0, 0, 0, 0.7);\n width: 100%;\n opacity: 0;\n -webkit-transition: opacity 0.5s ease-in-out;\n -moz-transition: opacity 0.5s ease-in-out;\n -o-transition: opacity 0.5s ease-in-out;\n transition: opacity 0.5s ease-in-out;\n overflow: hidden;\n }\n\n .lightbox-target.close {\n opacity: 0;\n }\n\n /* Styles the lightbox image, centers it vertically and horizontally, adds the zoom-in transition and makes it responsive using a combination of margin and absolute positioning */\n\n .lightbox-target img {\n margin: auto;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n max-height: 0%;\n max-width: 0%;\n border: 3px solid white;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);\n box-sizing: border-box;\n -webkit-transition: 0.5s ease-in-out;\n -moz-transition: 0.5s ease-in-out;\n -o-transition: 0.5s ease-in-out;\n transition: 0.5s ease-in-out;\n }\n\n /* Styles the close link, adds the slide down transition */\n\n a.lightbox-close {\n display: block;\n width: 50px;\n height: 50px;\n box-sizing: border-box;\n background: white;\n color: black;\n text-decoration: none;\n position: absolute;\n top: -80px;\n right: 0;\n -webkit-transition: 0.5s ease-in-out;\n -moz-transition: 0.5s ease-in-out;\n -o-transition: 0.5s ease-in-out;\n transition: 0.5s ease-in-out;\n }\n\n /* Provides part of the "X" to eliminate an image from the close link */\n\n a.lightbox-close:before {\n content: \'\';\n display: block;\n height: 30px;\n width: 1px;\n background: black;\n position: absolute;\n left: 26px;\n top: 10px;\n -webkit-transform: rotate(45deg);\n -moz-transform: rotate(45deg);\n -o-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n\n /* Provides part of the "X" to eliminate an image from the close link */\n\n a.lightbox-close:after {\n content: \'\';\n display: block;\n height: 30px;\n width: 1px;\n background: black;\n position: absolute;\n left: 26px;\n top: 10px;\n -webkit-transform: rotate(-45deg);\n -moz-transform: rotate(-45deg);\n -o-transform: rotate(-45deg);\n transform: rotate(-45deg);\n }\n\n /* Uses the :target pseudo-class to perform the animations upon clicking the .lightbox-target anchor */\n\n .lightbox-target.open {\n opacity: 1;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 9999;\n }\n\n .lightbox-target.open img {\n max-height: 100%;\n max-width: 100%;\n }\n\n .lightbox-target.open a.lightbox-close {\n top: 0px;\n }\n '
16974
17022
  )
16975
17023
  );
16976
17024
  };
@@ -29847,6 +29895,104 @@ var YahooHero = function YahooHero(props) {
29847
29895
  );
29848
29896
  };
29849
29897
 
29898
+ /*
29899
+ Sample query
29900
+ let references = ''
29901
+ if(article.taxonomyMapping.length > 0){
29902
+ article.taxonomyMapping.forEach((ref, index) => {
29903
+ references = references + `references('${ref._ref}') `
29904
+ if(index+1 !== article.taxonomyMapping.length){
29905
+ references = references + ` && `
29906
+ }
29907
+ })
29908
+ }
29909
+
29910
+ const relatedArticlesQuery = `*[!(_id in path("drafts.**")) && _type == "article" && title !='${article.title}' && defined(title) && is_visible == true && ( references('article.documentGroup._id') || ${references} ) && published <= '${today}'] | order(published desc) [0...4] {
29911
+ ...,
29912
+ title,
29913
+ summary,
29914
+ thumbnail,
29915
+ url,
29916
+ published,
29917
+ authorMapping[]->,
29918
+ contentCategory->
29919
+ }`
29920
+ const relatedArticles = await client.fetch(relatedArticlesQuery)
29921
+
29922
+ Sample usage
29923
+ <RelatedContent dataRecord={props.relatedArticles} client={client} showAuthor showPublished reverse/>
29924
+
29925
+
29926
+ */
29927
+ var RelatedContent = function RelatedContent(props) {
29928
+ var client = props.client,
29929
+ dataRecord = props.dataRecord,
29930
+ _props$defaultImage = props.defaultImage;
29931
+
29932
+ var builder = imageUrlBuilder(client);
29933
+ function urlFor(source) {
29934
+ return builder.image(source);
29935
+ }
29936
+
29937
+ return React__default.createElement(
29938
+ 'div',
29939
+ null,
29940
+ React__default.createElement(
29941
+ 'h1',
29942
+ { className: 'mb-4 pb-2', style: { borderBottom: '1px solid #ccc', fontSize: '1.2rem', fontWeight: 'bold', color: '#252525' } },
29943
+ 'Related Content'
29944
+ ),
29945
+ React__default.createElement(
29946
+ 'div',
29947
+ { className: 'related-articles-container' },
29948
+ dataRecord.map(function (article, index) {
29949
+ console.log(article);
29950
+ return React__default.createElement(
29951
+ Link,
29952
+ { href: '/view/[url]', as: '/view/' + article.url.current, key: index },
29953
+ React__default.createElement(
29954
+ 'a',
29955
+ { className: 'related-article' },
29956
+ React__default.createElement(
29957
+ 'figure',
29958
+ null,
29959
+ React__default.createElement('img', {
29960
+ src: urlFor(article.thumbnail.asset).width(500).url(),
29961
+ alt: article.title
29962
+ })
29963
+ ),
29964
+ React__default.createElement(
29965
+ 'div',
29966
+ { className: 'related-article-body' },
29967
+ React__default.createElement('h4', { dangerouslySetInnerHTML: { __html: article.title } }),
29968
+ props.showPublished && React__default.createElement(
29969
+ 'p',
29970
+ { className: 'pb-0 mb-0' },
29971
+ moment(article.published).format('MMMM DD, YYYY hh:mma')
29972
+ ),
29973
+ props.showAuthor && article.authorMapping && article.authorMapping[0] && React__default.createElement(
29974
+ 'p',
29975
+ null,
29976
+ 'By ',
29977
+ React__default.createElement(
29978
+ 'b',
29979
+ null,
29980
+ article.authorMapping[0].displayName
29981
+ )
29982
+ )
29983
+ )
29984
+ )
29985
+ );
29986
+ }),
29987
+ React__default.createElement(
29988
+ 'style',
29989
+ { jsx: 'true' },
29990
+ '\n .related-article {\n width: 100%;\n display: flex;\n flex-direction: ' + (props.reverse ? 'row-reverse' : 'row') + ';\n margin-bottom: 1rem;\n }\n .related-article figure {\n width: 165px;\n height: 110px;\n min-width: 165px;\n }\n .related-article figure img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n .related-article-body {\n flex: 1 1 auto;\n padding: 0 1rem;\n }\n .related-article-body h4 {\n font-weight: bold;\n font-size: 1.1rem;\n margin-bottom: 0.25rem;\n line-height: 1.3;\n }\n @media screen and (max-width: 430px) {\n .related-article {\n flex-direction: column;\n }\n .related-article figure {\n width: 80%;\n height: auto;\n min-width: 80%;\n margin: 0 auto;\n }\n .related-article figure img {\n width: 100%;\n height: auto;\n object-fit: cover;\n }\n }\n '
29991
+ )
29992
+ )
29993
+ );
29994
+ };
29995
+
29850
29996
  exports.DeckContent = ContentCard;
29851
29997
  exports.GridContent = GridContent$1;
29852
29998
  exports.DeckQueue = Queue;
@@ -29896,4 +30042,5 @@ exports.OncliveHero = OncliveHero;
29896
30042
  exports.OncliveLargeHero = OncliveLargeHero;
29897
30043
  exports.VerticalHero = VerticalHero;
29898
30044
  exports.YahooHero = YahooHero;
30045
+ exports.RelatedContent = RelatedContent;
29899
30046
  //# sourceMappingURL=index.js.map