@mjhls/mjh-framework 1.0.93 → 1.0.94

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
@@ -29,6 +29,7 @@ var Nav = _interopDefault(require('react-bootstrap/Nav'));
29
29
  var Navbar = _interopDefault(require('react-bootstrap/Navbar'));
30
30
  var NavDropdown = _interopDefault(require('react-bootstrap/NavDropdown'));
31
31
  var Carousel = _interopDefault(require('react-bootstrap/Carousel'));
32
+ var Breadcrumb = _interopDefault(require('react-bootstrap/Breadcrumb'));
32
33
 
33
34
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
34
35
 
@@ -5157,66 +5158,62 @@ var GridContent = function (_React$Component) {
5157
5158
  return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = GridContent.__proto__ || Object.getPrototypeOf(GridContent)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
5158
5159
  data: _this.data,
5159
5160
  per: _this.params ? _this.params.to : 2,
5160
- page: 1,
5161
+ page: _this.props.currentPage || 1,
5161
5162
  from: _this.params ? _this.params.from : 0,
5162
5163
  to: _this.params ? _this.params.to : 2,
5163
5164
  total_pages: null,
5164
5165
  scrolling: true,
5165
- query: _this.query
5166
- }, _this.loadMore = function () {
5167
- setTimeout(function () {
5168
- _this.setState(function (state, props) {
5169
- return {
5170
- page: state.page + 1,
5171
- from: state.from + state.per,
5172
- to: state.to + state.per
5173
- };
5174
- }, _this.loadData);
5175
- }, 10);
5176
- }, _this.loadData = function () {
5166
+ query: _this.query,
5167
+ currentPage: _this.props.currentPage || 1
5168
+ }, _this.loadMore = debounce_1(function () {
5169
+ _this.setState(function (state) {
5170
+ var page = state.page,
5171
+ from = state.from,
5172
+ per = state.per,
5173
+ to = state.to;
5174
+
5175
+ return {
5176
+ page: page + 1,
5177
+ from: from + per,
5178
+ to: to + per
5179
+ };
5180
+ }, _this.loadData);
5181
+ }, 0), _this.loadData = function () {
5177
5182
  var _this$state = _this.state,
5178
5183
  from = _this$state.from,
5179
5184
  to = _this$state.to,
5180
5185
  data = _this$state.data,
5181
- query = _this$state.query;
5186
+ query = _this$state.query,
5187
+ page = _this$state.page;
5182
5188
  var client = _this.props.client;
5183
5189
 
5184
5190
 
5185
5191
  var params = _extends({}, _this.params, { from: from, to: to
5186
5192
  // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
5187
-
5188
- });if (_this.pointer && _this.pointerArray) {
5189
- var pointer = _this.pointer;
5190
- client.fetch(query, params).then(function (dataArr) {
5191
- _this.setState(function (state, props) {
5192
- if (dataArr[_this.pointerArray][pointer].length > 0) {
5193
- return {
5194
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
5195
- scrolling: true
5196
- };
5197
- } else {
5198
- return {
5199
- scrolling: false
5200
- };
5201
- }
5193
+ });client.fetch(query, params).then(function (dataArr) {
5194
+ if (_this.pointer && _this.pointerArray) {
5195
+ var pointer = _this.pointer;
5196
+ dataArr = dataArr[_this.pointerArray][pointer];
5197
+ }
5198
+ dataArr = dataArr.map(function (item) {
5199
+ return _extends({}, item, {
5200
+ pageNumber: page
5202
5201
  });
5203
5202
  });
5204
- } else {
5205
- client.fetch(query, params).then(function (dataArr) {
5206
- _this.setState(function (state, props) {
5207
- if (dataArr.length > 0) {
5208
- return {
5209
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
5210
- scrolling: true
5211
- };
5212
- } else {
5213
- return {
5214
- scrolling: false
5215
- };
5216
- }
5217
- });
5203
+
5204
+ _this.setState(function () {
5205
+ if (dataArr.length > 0) {
5206
+ return {
5207
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
5208
+ scrolling: true
5209
+ };
5210
+ } else {
5211
+ return {
5212
+ scrolling: false
5213
+ };
5214
+ }
5218
5215
  });
5219
- }
5216
+ });
5220
5217
  }, _this.urlFor = function (source) {
5221
5218
  var client = _this.props.client;
5222
5219
 
@@ -5286,6 +5283,23 @@ var GridContent = function (_React$Component) {
5286
5283
  }
5287
5284
  }
5288
5285
  }
5286
+ }, _this.renderManualPagination = function () {
5287
+ var currentPage = _this.state.currentPage;
5288
+
5289
+ return React__default.createElement(
5290
+ 'div',
5291
+ { className: 'd-flex justify-content-between' },
5292
+ currentPage && currentPage > 1 && React__default.createElement(
5293
+ 'a',
5294
+ { href: '?page=' + (currentPage - 1) },
5295
+ '<< Previous'
5296
+ ),
5297
+ React__default.createElement(
5298
+ 'a',
5299
+ { href: '?page=' + (currentPage + 1) },
5300
+ 'Next >>'
5301
+ )
5302
+ );
5289
5303
  }, _temp), possibleConstructorReturn(_this, _ret);
5290
5304
  }
5291
5305
 
@@ -5336,7 +5350,7 @@ var GridContent = function (_React$Component) {
5336
5350
  ),
5337
5351
  _this2.props.showPublished && row.published && React__default.createElement(
5338
5352
  Card.Subtitle,
5339
- null,
5353
+ { style: { marginTop: 0 } },
5340
5354
  moment(row.published).format('MMMM DD, YYYY')
5341
5355
  ),
5342
5356
  React__default.createElement(
@@ -5396,6 +5410,11 @@ var GridContent = function (_React$Component) {
5396
5410
  null,
5397
5411
  row.title
5398
5412
  ),
5413
+ _this2.props.showPublished && row.published && React__default.createElement(
5414
+ Card.Subtitle,
5415
+ { style: { marginTop: 0 } },
5416
+ moment(row.published).format('MMMM DD, YYYY')
5417
+ ),
5399
5418
  React__default.createElement(
5400
5419
  Card.Text,
5401
5420
  { className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-subtext' },
@@ -5461,6 +5480,11 @@ var GridContent = function (_React$Component) {
5461
5480
  'End of data'
5462
5481
  )
5463
5482
  )
5483
+ ),
5484
+ React__default.createElement(
5485
+ 'noscript',
5486
+ null,
5487
+ this.renderManualPagination()
5464
5488
  )
5465
5489
  )
5466
5490
  );
@@ -7179,6 +7203,11 @@ var NavMagazine = function NavMagazine(props) {
7179
7203
  React__default.createElement(Search, null)
7180
7204
  )
7181
7205
  )
7206
+ ),
7207
+ React__default.createElement(
7208
+ 'style',
7209
+ { jsx: true },
7210
+ '\n @media screen and (max-width: 991px) {\n .dropdown-menu {\n max-height: 315px;\n overflow: auto;\n }\n ::-webkit-scrollbar {\n width: 10px;\n }\n ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(214, 214, 214, 0.8);\n box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n }\n }\n '
7182
7211
  )
7183
7212
  );
7184
7213
  };
@@ -7250,6 +7279,11 @@ var NavNative = function NavNative(props) {
7250
7279
  React__default.createElement(Search, null)
7251
7280
  )
7252
7281
  )
7282
+ ),
7283
+ React__default.createElement(
7284
+ 'style',
7285
+ { jsx: true },
7286
+ '\n @media screen and (max-width: 991px) {\n .dropdown-menu {\n max-height: 315px;\n overflow: auto;\n }\n ::-webkit-scrollbar {\n width: 10px;\n }\n ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(214, 214, 214, 0.8);\n box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n }\n }\n '
7253
7287
  )
7254
7288
  );
7255
7289
  };
@@ -7323,6 +7357,11 @@ var NavNormal = function NavNormal(props) {
7323
7357
  ),
7324
7358
  React__default.createElement(Search, null)
7325
7359
  )
7360
+ ),
7361
+ React__default.createElement(
7362
+ 'style',
7363
+ { jsx: true },
7364
+ '\n @media screen and (max-width: 991px) {\n .dropdown-menu {\n max-height: 315px;\n overflow: auto;\n }\n ::-webkit-scrollbar {\n width: 10px;\n }\n ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(214, 214, 214, 0.8);\n box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n }\n }\n '
7326
7365
  )
7327
7366
  );
7328
7367
  };
@@ -7428,7 +7467,7 @@ var NavDvm = function NavDvm(props) {
7428
7467
  React__default.createElement(
7429
7468
  'style',
7430
7469
  { jsx: 'true' },
7431
- '\n .mobile-logo{\n display: none;\n position: absolute;\n left: 50%;\n top: 0;\n height: 40px;\n transform: translateX(-50%);\n }\n .mobile-logo img{\n height: 100%;\n }\n @media screen and (max-width: 1199px){\n .mobile-logo{\n display: block;\n }\n .top-nav{\n display: none;\n }\n }\n '
7470
+ '\n .mobile-logo{\n display: none;\n position: absolute;\n left: 50%;\n top: 0;\n height: 40px;\n transform: translateX(-50%);\n }\n .mobile-logo img{\n height: 100%;\n }\n @media screen and (max-width: 1199px){\n .mobile-logo{\n display: block;\n }\n .top-nav{\n display: none;\n }\n }\n @media screen and (max-width: 991px) {\n .dropdown-menu {\n max-height: 315px;\n overflow: auto;\n }\n ::-webkit-scrollbar {\n width: 10px;\n }\n ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(214, 214, 214, 0.8);\n box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n }\n }\n \n '
7432
7471
  )
7433
7472
  );
7434
7473
  };
@@ -8502,7 +8541,7 @@ var urlFor$1 = function urlFor(source, builder) {
8502
8541
  var onChangeSlide = function onChangeSlide(selectedIndex, pageview, setCarouselIndex, asPath) {
8503
8542
  setCarouselIndex(selectedIndex);
8504
8543
  lib_3.refresh();
8505
- pageview(asPath);
8544
+ if (pageview) pageview(asPath);
8506
8545
  };
8507
8546
 
8508
8547
  var Slideshow = function Slideshow(_ref) {
@@ -8521,7 +8560,7 @@ var Slideshow = function Slideshow(_ref) {
8521
8560
 
8522
8561
  return React__default.createElement(
8523
8562
  'div',
8524
- { style: { marginTop: '1em', marginBottom: '1em' } },
8563
+ { className: 'mt-3 mb-3' },
8525
8564
  React__default.createElement(
8526
8565
  reactBootstrap.Carousel,
8527
8566
  { activeIndex: carouselIndex, onSelect: function onSelect(selectedIndex, e) {
@@ -8531,7 +8570,12 @@ var Slideshow = function Slideshow(_ref) {
8531
8570
  return React__default.createElement(
8532
8571
  reactBootstrap.Carousel.Item,
8533
8572
  { key: slide._key },
8534
- React__default.createElement('img', { src: urlFor$1(slide.asset, builder).url(), style: { width: '100%' } })
8573
+ React__default.createElement('img', { src: slide.image && urlFor$1(slide.image, builder).url(), style: { width: '100%' } }),
8574
+ React__default.createElement(
8575
+ 'p',
8576
+ { className: 'p-2' },
8577
+ slide.caption
8578
+ )
8535
8579
  );
8536
8580
  })
8537
8581
  )
@@ -12079,7 +12123,7 @@ var Sidebar = function Sidebar(_ref) {
12079
12123
 
12080
12124
  return React__default.createElement(
12081
12125
  'article',
12082
- { className: 'sidebar', style: { background: '#eee', marginRight: '10%', marginLeft: '1rem', width: '40%', padding: '1rem 0 0' } },
12126
+ { className: 'sidebar', style: { background: '#eee' } },
12083
12127
  React__default.createElement(
12084
12128
  'div',
12085
12129
  null,
@@ -12089,6 +12133,11 @@ var Sidebar = function Sidebar(_ref) {
12089
12133
  caption
12090
12134
  ),
12091
12135
  React__default.createElement(BlockContent, { blocks: content })
12136
+ ),
12137
+ React__default.createElement(
12138
+ 'style',
12139
+ { jsx: true },
12140
+ '\n .sidebar {\n width: 40%;\n padding: 1rem 0 0;\n margin-left: 1rem;\n margin-right: 10%;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n width: unset;\n padding: 1.25rem;\n margin-left: 1rem;\n margin-right: 1rem;\n }\n }\n '
12092
12141
  )
12093
12142
  );
12094
12143
  };
@@ -12192,7 +12241,7 @@ var Audio = function Audio(_ref) {
12192
12241
  { className: 'd-block text-center mb-3' },
12193
12242
  React__default.createElement(
12194
12243
  'audio',
12195
- { controls: true },
12244
+ { controls: true, controlsList: 'nodownload' },
12196
12245
  React__default.createElement('source', { src: node.uploadAudio ? node.uploadAudio.asset.url : node.audioFilePth, type: 'audio/ogg' }),
12197
12246
  React__default.createElement('source', { src: node.uploadAudio ? node.uploadAudio.asset.url : node.audioFilePth, type: 'audio/mpeg' }),
12198
12247
  'Your browser does not support the audio element.'
@@ -12519,6 +12568,50 @@ var Feature = function Feature(props) {
12519
12568
  );
12520
12569
  };
12521
12570
 
12571
+ var Breadcrumbs = function Breadcrumbs() {
12572
+ // To be used on landing pages eg. /news/[url]
12573
+ var _useState = React.useState(''),
12574
+ _useState2 = slicedToArray(_useState, 2),
12575
+ parentPath = _useState2[0],
12576
+ setParentPath = _useState2[1];
12577
+
12578
+ var _useState3 = React.useState(''),
12579
+ _useState4 = slicedToArray(_useState3, 2),
12580
+ currentPath = _useState4[0],
12581
+ setCurrentPath = _useState4[1];
12582
+
12583
+ React.useEffect(function () {
12584
+ var parsedUrl = window.location.href.split('/');
12585
+ setCurrentPath(parsedUrl[parsedUrl.length - 1]);
12586
+ setParentPath(parsedUrl[parsedUrl.length - 2]);
12587
+ });
12588
+
12589
+ return React__default.createElement(
12590
+ Breadcrumb,
12591
+ null,
12592
+ React__default.createElement(
12593
+ Breadcrumb.Item,
12594
+ { href: '/' },
12595
+ 'home'
12596
+ ),
12597
+ React__default.createElement(
12598
+ Breadcrumb.Item,
12599
+ { href: '/' + parentPath },
12600
+ parentPath
12601
+ ),
12602
+ React__default.createElement(
12603
+ Breadcrumb.Item,
12604
+ { active: true },
12605
+ currentPath
12606
+ ),
12607
+ React__default.createElement(
12608
+ 'style',
12609
+ { jsx: true },
12610
+ '\n ol.breadcrumb {\n background: transparent;\n padding-left: 0.25rem;\n }\n '
12611
+ )
12612
+ );
12613
+ };
12614
+
12522
12615
  exports.DeckContent = ContentCard;
12523
12616
  exports.GridContent = GridContent$1;
12524
12617
  exports.DeckQueue = DeckQueue;
@@ -12545,4 +12638,5 @@ exports.AD728x90 = AD728x90;
12545
12638
  exports.getSerializers = getSerializers$1;
12546
12639
  exports.Search = Search;
12547
12640
  exports.Feature = Feature;
12641
+ exports.Breadcrumbs = Breadcrumbs;
12548
12642
  //# sourceMappingURL=index.js.map