@mjhls/mjh-framework 1.0.94 → 1.0.95

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
@@ -14,7 +14,8 @@ var Col = _interopDefault(require('react-bootstrap/Col'));
14
14
  var Card = _interopDefault(require('react-bootstrap/Card'));
15
15
  var moment = _interopDefault(require('moment'));
16
16
  var Link = _interopDefault(require('next/link'));
17
- var router = require('next/router');
17
+ var Router = require('next/router');
18
+ var Router__default = _interopDefault(Router);
18
19
  var Media = _interopDefault(require('react-bootstrap/Media'));
19
20
  var reactBootstrap = require('react-bootstrap');
20
21
  var ListGroup = _interopDefault(require('react-bootstrap/ListGroup'));
@@ -3897,19 +3898,19 @@ var DeckContent = function (_React$Component) {
3897
3898
  var _this$props = _this.props,
3898
3899
  seoPaginate = _this$props.seoPaginate,
3899
3900
  pageview = _this$props.pageview,
3900
- router$$1 = _this$props.router;
3901
+ router = _this$props.router;
3901
3902
  var currentPage = _this.state.currentPage;
3902
3903
 
3903
3904
  if (seoPaginate) {
3904
- var path = router$$1.asPath;
3905
+ var path = router.asPath;
3905
3906
  var qrIndex = path.indexOf('?');
3906
- var pathname = router$$1.pathname;
3907
+ var pathname = router.pathname;
3907
3908
  var queryString = '';
3908
3909
 
3909
3910
  if (qrIndex > 0) {
3910
3911
  path = path.substring(1, qrIndex);
3911
3912
 
3912
- var partialQS = router$$1.asPath.substring(qrIndex + 1);
3913
+ var partialQS = router.asPath.substring(qrIndex + 1);
3913
3914
  var partialQSArr = partialQS.split('&');
3914
3915
 
3915
3916
  // exclude page=xxx from query string
@@ -3955,7 +3956,7 @@ var DeckContent = function (_React$Component) {
3955
3956
 
3956
3957
  pageview(newPath);
3957
3958
 
3958
- router$$1.push(pathname, newPath, {
3959
+ router.push(pathname, newPath, {
3959
3960
  shallow: true
3960
3961
  });
3961
3962
  });
@@ -3980,8 +3981,7 @@ var DeckContent = function (_React$Component) {
3980
3981
  }
3981
3982
 
3982
3983
  var pageNumber = row.pageNumber || _this.state.page;
3983
- var contentCategoryName = row.contentCategory ? row.contentCategory.name : 'Articles';
3984
-
3984
+ var contentCategoryName = row.contentCategory && row.contentCategory.name && _this.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
3985
3985
  return React__default.createElement(
3986
3986
  VisibilitySensor,
3987
3987
  {
@@ -4152,7 +4152,7 @@ var DeckContent = function (_React$Component) {
4152
4152
  return DeckContent;
4153
4153
  }(React__default.Component);
4154
4154
 
4155
- var ContentCard = router.withRouter(DeckContent);
4155
+ var ContentCard = Router.withRouter(DeckContent);
4156
4156
 
4157
4157
  /**
4158
4158
  * Checks if `value` is classified as an `Array` object.
@@ -5229,19 +5229,19 @@ var GridContent = function (_React$Component) {
5229
5229
  var _this$props = _this.props,
5230
5230
  seoPaginate = _this$props.seoPaginate,
5231
5231
  pageview = _this$props.pageview,
5232
- router$$1 = _this$props.router;
5232
+ router = _this$props.router;
5233
5233
  var currentPage = _this.state.currentPage;
5234
5234
 
5235
5235
  if (seoPaginate) {
5236
- var path = router$$1.asPath;
5236
+ var path = router.asPath;
5237
5237
  var qrIndex = path.indexOf('?');
5238
- var pathname = router$$1.pathname;
5238
+ var pathname = router.pathname;
5239
5239
  var queryString = '';
5240
5240
 
5241
5241
  if (qrIndex > 0) {
5242
5242
  path = path.substring(1, qrIndex);
5243
5243
 
5244
- var partialQS = router$$1.asPath.substring(qrIndex + 1);
5244
+ var partialQS = router.asPath.substring(qrIndex + 1);
5245
5245
  var partialQSArr = partialQS.split('&');
5246
5246
 
5247
5247
  // exclude page=xxx from query string
@@ -5276,7 +5276,7 @@ var GridContent = function (_React$Component) {
5276
5276
 
5277
5277
  pageview(newPath);
5278
5278
 
5279
- router$$1.push(pathname, newPath, {
5279
+ router.push(pathname, newPath, {
5280
5280
  shallow: true
5281
5281
  });
5282
5282
  });
@@ -5373,7 +5373,7 @@ var GridContent = function (_React$Component) {
5373
5373
  { className: 'grid-container' },
5374
5374
  this.state.data && this.state.data.map(function (row, index$$1) {
5375
5375
  var pageNumber = row.pageNumber || _this2.state.page;
5376
- var contentCategoryName = row.contentCategory ? row.contentCategory.name : 'Articles';
5376
+ var contentCategoryName = row.contentCategory && row.contentCategory.name && _this2.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
5377
5377
  return React__default.createElement(
5378
5378
  VisibilitySensor,
5379
5379
  {
@@ -5493,7 +5493,7 @@ var GridContent = function (_React$Component) {
5493
5493
  return GridContent;
5494
5494
  }(React__default.Component);
5495
5495
 
5496
- var GridContent$1 = router.withRouter(GridContent);
5496
+ var GridContent$1 = Router.withRouter(GridContent);
5497
5497
 
5498
5498
  var DeckQueue = function (_React$Component) {
5499
5499
  inherits(DeckQueue, _React$Component);
@@ -5509,74 +5509,151 @@ var DeckQueue = function (_React$Component) {
5509
5509
  args[_key] = arguments[_key];
5510
5510
  }
5511
5511
 
5512
- return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DeckQueue.__proto__ || Object.getPrototypeOf(DeckQueue)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _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.state = {
5512
+ return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DeckQueue.__proto__ || Object.getPrototypeOf(DeckQueue)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _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 = {
5513
5513
  data: _this.data,
5514
5514
  per: _this.params ? _this.params.to : 2,
5515
- page: 1,
5515
+ page: _this.props.currentPage || 1,
5516
5516
  from: _this.params ? _this.params.from : 0,
5517
5517
  to: _this.params ? _this.params.to : 2,
5518
5518
  total_pages: null,
5519
5519
  scrolling: true,
5520
- query: _this.query
5521
- }, _this.loadMore = function () {
5522
- setTimeout(function () {
5523
- _this.setState(function (state, props) {
5524
- return {
5525
- page: state.page + 1,
5526
- from: state.from + state.per,
5527
- to: state.to + state.per
5528
- };
5529
- }, _this.loadData);
5530
- }, 10);
5531
- }, _this.loadData = function () {
5520
+ query: _this.query,
5521
+ currentPage: _this.props.currentPage || 1
5522
+ }, _this.loadMore = debounce_1(function () {
5523
+ _this.setState(function (state) {
5524
+ var page = state.page,
5525
+ from = state.from,
5526
+ per = state.per,
5527
+ to = state.to;
5528
+
5529
+ return {
5530
+ page: page + 1,
5531
+ from: from + per,
5532
+ to: to + per
5533
+ };
5534
+ }, _this.loadData);
5535
+ }, 0), _this.loadData = function () {
5532
5536
  var _this$state = _this.state,
5533
5537
  from = _this$state.from,
5534
5538
  to = _this$state.to,
5535
5539
  data = _this$state.data,
5536
- query = _this$state.query;
5540
+ query = _this$state.query,
5541
+ page = _this$state.page;
5537
5542
  var client = _this.props.client;
5538
5543
 
5539
5544
 
5540
5545
  var params = _extends({}, _this.params, { from: from, to: to
5541
5546
  // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
5542
-
5543
- });if (_this.pointer && _this.pointerArray) {
5544
- var pointer = _this.pointer;
5545
- client.fetch(query, params).then(function (dataArr) {
5546
- _this.setState(function (state, props) {
5547
- if (dataArr[_this.pointerArray][pointer].length > 0) {
5548
- return {
5549
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
5550
- scrolling: true
5551
- };
5552
- } else {
5553
- return {
5554
- scrolling: false
5555
- };
5556
- }
5547
+ });client.fetch(query, params).then(function (dataArr) {
5548
+ if (_this.pointer && _this.pointerArray) {
5549
+ var pointer = _this.pointer;
5550
+ dataArr = dataArr[_this.pointerArray][pointer];
5551
+ }
5552
+ dataArr = dataArr.map(function (item) {
5553
+ return _extends({}, item, {
5554
+ pageNumber: page
5557
5555
  });
5558
5556
  });
5559
- } else {
5560
- client.fetch(query, params).then(function (dataArr) {
5561
- _this.setState(function (state, props) {
5562
- if (dataArr.length > 0) {
5563
- return {
5564
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
5565
- scrolling: true
5566
- };
5567
- } else {
5568
- return {
5569
- scrolling: false
5570
- };
5571
- }
5572
- });
5557
+
5558
+ _this.setState(function () {
5559
+ if (dataArr.length > 0) {
5560
+ return {
5561
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
5562
+ scrolling: true
5563
+ };
5564
+ } else {
5565
+ return {
5566
+ scrolling: false
5567
+ };
5568
+ }
5573
5569
  });
5574
- }
5570
+ });
5575
5571
  }, _this.urlFor = function (source) {
5576
5572
  var client = _this.props.client;
5577
5573
 
5578
5574
  var builder = imageUrlBuilder(client);
5579
5575
  return builder.image(source);
5576
+ }, _this.renderCardImage = function (row, page) {
5577
+ if (row.thumbnail) {
5578
+ return _this.urlFor(row.thumbnail).url();
5579
+ } else {
5580
+ return _this.defaultImage;
5581
+ }
5582
+ }, _this.changePageNumber = function (pageNumber) {
5583
+ var _this$props = _this.props,
5584
+ seoPaginate = _this$props.seoPaginate,
5585
+ pageview = _this$props.pageview,
5586
+ router = _this$props.router;
5587
+ var currentPage = _this.state.currentPage;
5588
+
5589
+ if (seoPaginate) {
5590
+ var path = router.asPath;
5591
+ var qrIndex = path.indexOf('?');
5592
+ var pathname = router.pathname;
5593
+ var queryString = '';
5594
+
5595
+ if (qrIndex > 0) {
5596
+ path = path.substring(1, qrIndex);
5597
+
5598
+ var partialQS = router.asPath.substring(qrIndex + 1);
5599
+ var partialQSArr = partialQS.split('&');
5600
+
5601
+ // exclude page=xxx from query string
5602
+ partialQSArr.map(function (item) {
5603
+ var itemArr = item.split('=');
5604
+ var key = itemArr[0];
5605
+ var val = itemArr[1];
5606
+
5607
+ if (key !== 'page') {
5608
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
5609
+ }
5610
+ });
5611
+ }
5612
+
5613
+ if (queryString.length > 0) {
5614
+ path += '?' + queryString;
5615
+ }
5616
+
5617
+ pageNumber = parseInt(pageNumber);
5618
+
5619
+ if (currentPage !== pageNumber) {
5620
+ lib_3.refresh();
5621
+ if (pageview) {
5622
+ _this.setState({
5623
+ currentPage: pageNumber
5624
+ }, function () {
5625
+ if (path[0] !== '/') {
5626
+ path = '/' + path;
5627
+ }
5628
+
5629
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
5630
+
5631
+ pageview(newPath);
5632
+
5633
+ router.push(pathname, newPath, {
5634
+ shallow: true
5635
+ });
5636
+ });
5637
+ }
5638
+ }
5639
+ }
5640
+ }, _this.renderManualPagination = function () {
5641
+ var currentPage = _this.state.currentPage;
5642
+
5643
+ return React__default.createElement(
5644
+ 'div',
5645
+ { className: 'd-flex justify-content-between' },
5646
+ currentPage && currentPage > 1 && React__default.createElement(
5647
+ 'a',
5648
+ { href: '?page=' + (currentPage - 1) },
5649
+ '<< Previous'
5650
+ ),
5651
+ React__default.createElement(
5652
+ 'a',
5653
+ { href: '?page=' + (currentPage + 1) },
5654
+ 'Next >>'
5655
+ )
5656
+ );
5580
5657
  }, _temp), possibleConstructorReturn(_this, _ret);
5581
5658
  }
5582
5659
 
@@ -5591,64 +5668,73 @@ var DeckQueue = function (_React$Component) {
5591
5668
  return React__default.createElement(
5592
5669
  Row,
5593
5670
  null,
5594
- this.state.data && this.state.data.map(function (row, index) {
5671
+ this.state.data && this.state.data.map(function (row, index$$1) {
5672
+ var pageNumber = row.pageNumber || _this2.state.page;
5595
5673
  // const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
5596
5674
  var thumbnailURL = row.thumbnail ? _this2.urlFor(row.thumbnail).url() : _this2.props.defaultImage;
5597
5675
  return React__default.createElement(
5598
- Col,
5599
- { key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
5676
+ VisibilitySensor,
5677
+ {
5678
+ key: index$$1,
5679
+ onChange: function onChange(isVisible) {
5680
+ isVisible && _this2.changePageNumber(pageNumber);
5681
+ } },
5600
5682
  React__default.createElement(
5601
- Card,
5602
- { className: 'queue-card', style: { borderTop: '1px solid #EEE' } },
5683
+ Col,
5684
+ { md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
5603
5685
  React__default.createElement(
5604
- Row,
5605
- { style: { flexDirection: mode } },
5606
- React__default.createElement(
5607
- Col,
5608
- { md: 12, lg: 4 },
5609
- React__default.createElement(
5610
- Link,
5611
- { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
5612
- React__default.createElement(Card.Img, { variant: 'top', src: thumbnailURL })
5613
- )
5614
- ),
5686
+ Card,
5687
+ { className: 'queue-card', style: { borderTop: '1px solid #EEE' } },
5615
5688
  React__default.createElement(
5616
- Col,
5617
- null,
5689
+ Row,
5690
+ { style: { flexDirection: mode } },
5618
5691
  React__default.createElement(
5619
- Card.Body,
5620
- { style: { padding: '20px' } },
5621
- row.title && React__default.createElement(
5692
+ Col,
5693
+ { md: 12, lg: 4 },
5694
+ React__default.createElement(
5622
5695
  Link,
5623
5696
  { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
5624
- React__default.createElement(
5625
- Card.Title,
5626
- null,
5627
- row.title
5628
- )
5629
- ),
5630
- _this2.props.showPublished && row.published && React__default.createElement(
5631
- Card.Subtitle,
5632
- null,
5633
- moment(row.published).format('MMMM DD, YYYY')
5634
- ),
5635
- _this2.props.showRecent && row.recent && row.recent.title && React__default.createElement(
5636
- Card.Subtitle,
5637
- null,
5638
- 'Recent : ',
5639
- React__default.createElement(
5697
+ React__default.createElement(Card.Img, { variant: 'top', src: thumbnailURL })
5698
+ )
5699
+ ),
5700
+ React__default.createElement(
5701
+ Col,
5702
+ null,
5703
+ React__default.createElement(
5704
+ Card.Body,
5705
+ { style: { padding: '20px' } },
5706
+ row.title && React__default.createElement(
5640
5707
  Link,
5641
- { href: 'view/' + row.recent.url.current },
5642
- row.recent.title
5643
- )
5644
- ),
5645
- row.summary && React__default.createElement(
5646
- Link,
5647
- { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
5648
- React__default.createElement(
5649
- Card.Text,
5708
+ { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
5709
+ React__default.createElement(
5710
+ Card.Title,
5711
+ null,
5712
+ row.title
5713
+ )
5714
+ ),
5715
+ _this2.props.showPublished && row.published && React__default.createElement(
5716
+ Card.Subtitle,
5650
5717
  null,
5651
- row.summary
5718
+ moment(row.published).format('MMMM DD, YYYY')
5719
+ ),
5720
+ _this2.props.showRecent && row.recent && row.recent.title && React__default.createElement(
5721
+ Card.Subtitle,
5722
+ null,
5723
+ 'Recent : ',
5724
+ React__default.createElement(
5725
+ Link,
5726
+ { href: 'view/' + row.recent.url.current },
5727
+ row.recent.title
5728
+ )
5729
+ ),
5730
+ row.summary && React__default.createElement(
5731
+ Link,
5732
+ { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
5733
+ React__default.createElement(
5734
+ Card.Text,
5735
+ null,
5736
+ row.summary
5737
+ )
5652
5738
  )
5653
5739
  )
5654
5740
  )
@@ -5710,6 +5796,11 @@ var DeckQueue = function (_React$Component) {
5710
5796
  'End of data'
5711
5797
  )
5712
5798
  )
5799
+ ),
5800
+ React__default.createElement(
5801
+ 'noscript',
5802
+ null,
5803
+ this.renderManualPagination()
5713
5804
  )
5714
5805
  )
5715
5806
  );
@@ -5718,6 +5809,8 @@ var DeckQueue = function (_React$Component) {
5718
5809
  return DeckQueue;
5719
5810
  }(React__default.Component);
5720
5811
 
5812
+ var Queue = Router.withRouter(DeckQueue);
5813
+
5721
5814
  var ThumbnailCard = function ThumbnailCard(_ref) {
5722
5815
  var size = _ref.size,
5723
5816
  mediaData = _ref.mediaData,
@@ -6260,17 +6353,17 @@ var loadData = function loadData(values, query, client, params, setData, setScro
6260
6353
  });
6261
6354
  };
6262
6355
 
6263
- var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pageview, router$$1, currentPage, setCurrentPage) {
6356
+ var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage) {
6264
6357
  if (seoPaginate) {
6265
- var path = router$$1.asPath;
6358
+ var path = router.asPath;
6266
6359
  var qrIndex = path.indexOf('?');
6267
- var pathname = router$$1.pathname;
6360
+ var pathname = router.pathname;
6268
6361
  var queryString = '';
6269
6362
 
6270
6363
  if (qrIndex > 0) {
6271
6364
  path = path.substring(1, qrIndex);
6272
6365
 
6273
- var partialQS = router$$1.asPath.substring(qrIndex + 1);
6366
+ var partialQS = router.asPath.substring(qrIndex + 1);
6274
6367
  var partialQSArr = partialQS.split('&');
6275
6368
 
6276
6369
  // exclude page=xxx from query string
@@ -6300,7 +6393,7 @@ var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pagevi
6300
6393
  }
6301
6394
  var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
6302
6395
  pageview(newPath);
6303
- router$$1.push(pathname, newPath, {
6396
+ router.push(pathname, newPath, {
6304
6397
  shallow: true
6305
6398
  });
6306
6399
  }
@@ -6330,7 +6423,7 @@ var renderAuthor = function renderAuthor(authorName, authorURL, index$$1, length
6330
6423
  }
6331
6424
  };
6332
6425
 
6333
- var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate, pageview, router$$1, currentPage, setCurrentPage, showPublished, defaultImage) {
6426
+ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage) {
6334
6427
  return React__default.createElement(
6335
6428
  'div',
6336
6429
  null,
@@ -6342,7 +6435,7 @@ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate
6342
6435
  {
6343
6436
  key: article._id ? article._id : index$$1,
6344
6437
  onChange: function onChange(isVisible) {
6345
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router$$1, currentPage, setCurrentPage);
6438
+ isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage);
6346
6439
  } },
6347
6440
  React__default.createElement(
6348
6441
  React__default.Fragment,
@@ -6430,7 +6523,7 @@ var usePrevious = function usePrevious(value) {
6430
6523
  };
6431
6524
 
6432
6525
  var QueueDeckExpanded = function QueueDeckExpanded(props) {
6433
- var router$$1 = router.useRouter();
6526
+ var router = Router.useRouter();
6434
6527
  var initialData = props.dataRecord,
6435
6528
  client = props.client,
6436
6529
  params = props.params,
@@ -6500,7 +6593,7 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
6500
6593
  React__default.createElement(
6501
6594
  reactBootstrap.Container,
6502
6595
  null,
6503
- cardLoader(data, builder, mapping, values, seoPaginate, pageview, router$$1, currentPage, setCurrentPage, showPublished, defaultImage)
6596
+ cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage)
6504
6597
  )
6505
6598
  ),
6506
6599
  React__default.createElement(
@@ -6514,7 +6607,7 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
6514
6607
  React__default.createElement(
6515
6608
  reactBootstrap.Container,
6516
6609
  null,
6517
- cardLoader(data, builder, mapping, values, seoPaginate, pageview, router$$1, currentPage, setCurrentPage, showPublished, defaultImage)
6610
+ cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage)
6518
6611
  ),
6519
6612
  React__default.createElement(
6520
6613
  'div',
@@ -7045,19 +7138,32 @@ var Search = function Search(_ref) {
7045
7138
  _ref$btnText = _ref.btnText,
7046
7139
  btnText = _ref$btnText === undefined ? 'Search' : _ref$btnText;
7047
7140
 
7048
- var router$$1 = router.useRouter();
7141
+ var router = Router.useRouter();
7049
7142
 
7050
7143
  var _useState = React.useState(''),
7051
7144
  _useState2 = slicedToArray(_useState, 2),
7052
7145
  searchKey = _useState2[0],
7053
7146
  setSearchKey = _useState2[1];
7054
7147
 
7055
- var handleSearch = function handleSearch(value) {
7056
- router$$1.push({
7057
- pathname: '/search',
7058
- query: { searchTerm: value }
7148
+ var _useState3 = React.useState(false),
7149
+ _useState4 = slicedToArray(_useState3, 2),
7150
+ activesearch = _useState4[0],
7151
+ setActivesearch = _useState4[1];
7152
+
7153
+ React.useEffect(function () {
7154
+ if (activesearch) {
7155
+ router.push({
7156
+ pathname: '/search',
7157
+ query: { searchTerm: searchKey }
7158
+ });
7159
+ }
7160
+ }, [activesearch]);
7161
+
7162
+ React.useEffect(function () {
7163
+ Router__default.events.on('routeChangeComplete', function () {
7164
+ return setActivesearch(false);
7059
7165
  });
7060
- };
7166
+ });
7061
7167
 
7062
7168
  return React__default.createElement(
7063
7169
  Form,
@@ -7065,16 +7171,17 @@ var Search = function Search(_ref) {
7065
7171
  inline: true,
7066
7172
  onSubmit: function onSubmit(e) {
7067
7173
  e.preventDefault();
7068
- handleSearch(searchKey);
7174
+ setActivesearch(true);
7069
7175
  } },
7176
+ activesearch && React__default.createElement(reactBootstrap.Spinner, { className: 'active-loader mr-3', animation: 'border', variant: 'light' }),
7070
7177
  React__default.createElement(FormControl, { type: 'text', placeholder: placeholder, className: 'mr-sm-2', value: searchKey, onChange: function onChange(e) {
7071
7178
  return setSearchKey(e.target.value);
7072
7179
  } }),
7073
7180
  React__default.createElement(
7074
7181
  Button,
7075
7182
  { variant: 'secondary', onClick: function onClick() {
7076
- return handleSearch(searchKey);
7077
- } },
7183
+ return setActivesearch(true);
7184
+ }, disabled: activesearch },
7078
7185
  btnText
7079
7186
  )
7080
7187
  );
@@ -8549,7 +8656,7 @@ var Slideshow = function Slideshow(_ref) {
8549
8656
  client = _ref.client,
8550
8657
  pageview = _ref.pageview;
8551
8658
 
8552
- var router$$1 = router.useRouter();
8659
+ var router = Router.useRouter();
8553
8660
 
8554
8661
  var _useState = React.useState(0),
8555
8662
  _useState2 = slicedToArray(_useState, 2),
@@ -8564,14 +8671,14 @@ var Slideshow = function Slideshow(_ref) {
8564
8671
  React__default.createElement(
8565
8672
  reactBootstrap.Carousel,
8566
8673
  { activeIndex: carouselIndex, onSelect: function onSelect(selectedIndex, e) {
8567
- return onChangeSlide(selectedIndex, pageview, setCarouselIndex, router$$1.asPath);
8674
+ return onChangeSlide(selectedIndex, pageview, setCarouselIndex, router.asPath);
8568
8675
  } },
8569
8676
  slides && slides.map(function (slide) {
8570
8677
  return React__default.createElement(
8571
8678
  reactBootstrap.Carousel.Item,
8572
8679
  { key: slide._key },
8573
- React__default.createElement('img', { src: slide.image && urlFor$1(slide.image, builder).url(), style: { width: '100%' } }),
8574
- React__default.createElement(
8680
+ React__default.createElement('img', { src: slide.asset && urlFor$1(slide.asset, builder).url(), alt: slide.alt && slide.alt, style: { width: '100%' } }),
8681
+ slide.caption && React__default.createElement(
8575
8682
  'p',
8576
8683
  { className: 'p-2' },
8577
8684
  slide.caption
@@ -12258,7 +12365,7 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
12258
12365
  var nodes = _ref.nodes,
12259
12366
  client = _ref.client;
12260
12367
 
12261
- var router$$1 = router.useRouter();
12368
+ var router = Router.useRouter();
12262
12369
  //state
12263
12370
 
12264
12371
  var _useState = React.useState(''),
@@ -12278,8 +12385,8 @@ var YouTubeGallery = function YouTubeGallery(_ref) {
12278
12385
  //variables
12279
12386
 
12280
12387
 
12281
- var get2 = router$$1.asPath.split('/')[1];
12282
- var get3 = router$$1.asPath.split('/')[2].split('?')[0];
12388
+ var get2 = router.asPath.split('/')[1];
12389
+ var get3 = router.asPath.split('/')[2].split('?')[0];
12283
12390
 
12284
12391
  // Once component mounts, set the variables
12285
12392
  React.useEffect(function () {
@@ -12614,7 +12721,7 @@ var Breadcrumbs = function Breadcrumbs() {
12614
12721
 
12615
12722
  exports.DeckContent = ContentCard;
12616
12723
  exports.GridContent = GridContent$1;
12617
- exports.DeckQueue = DeckQueue;
12724
+ exports.DeckQueue = Queue;
12618
12725
  exports.ThumbnailCard = ThumbnailCard;
12619
12726
  exports.TaxonomyCard = TaxonomyCard;
12620
12727
  exports.GroupDeck = GroupDeck;