@mjhls/mjh-framework 1.0.59 → 1.0.61

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,170 +1,170 @@
1
- # mjh-framework v. 1.0.55
2
-
3
- > Foundation Framework
4
-
5
- [![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)
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install --save @mjhls/mjh-framework
11
- ```
12
-
13
- ## Usage
14
-
15
- ```jsx
16
- import React, { Component } from 'react'
17
-
18
- import { NavMagazine, DeckQueue } from 'mjh-framework'
19
-
20
- export default class App extends Component {
21
- render() {
22
- return (
23
- <div>
24
- <NavMagazine />
25
- <DeckQueue />
26
- </div>
27
- )
28
- }
29
- }
30
- ```
31
-
32
- ## Publish new updates to the npm registry
33
-
34
- ```bash
35
- npm publish
36
- ```
37
-
38
- ## For getting updates in the template without publishing each time a change is made in the framework
39
-
40
- Link react and react-dom of the template repo, so that it can be used by the framework.
41
- This is to avoid the error arising due to multiple instances of React.
42
-
43
- ```bash
44
- cd ../mjh-template/node_modules/react
45
-
46
- yarn link
47
-
48
- cd ../react-dom
49
-
50
- yarn link
51
-
52
- cd ../../../mjh-framework
53
-
54
- yarn link react && yarn link react-dom
55
- ```
56
-
57
- Link the framework repo so that it can be used in the template
58
-
59
- ```bash
60
- npm link
61
-
62
- cd ../mjh-template
63
-
64
- npm link @mjhls/mjh-framework
65
- ```
66
-
67
- ## Components and "props"
68
-
69
- ### Deck Components
70
-
71
- - #### DeckContent
72
-
73
- ##### Props
74
-
75
- - mapping
76
- - dataRecord
77
- - query
78
- - params
79
- - pointer
80
- - pointerArray
81
- - defaultImage
82
-
83
- - #### DeckQueue
84
- ##### Props
85
- - page
86
- - dataRecord
87
- - query
88
- - params
89
- - pointer
90
- - pointerArray
91
-
92
- ### Layout Components
93
-
94
- - #### Column1
95
- - #### Column2
96
- ##### Props
97
- - rightItems
98
- - #### Column3
99
- ##### Props
100
- - leftItems
101
- - rightItems
102
- ##### Common Props (Column1, Column2, Column3)
103
- - title
104
- - children
105
- - #### Header
106
- ##### Props
107
- - title
108
- - keyword
109
- - description
110
- - #### LeftNav
111
- ##### Props
112
- - leftItems
113
- - #### AccordionPanel
114
- ##### Props
115
- - accordionClassName
116
- - data
117
-
118
- ### Navigation Components
119
-
120
- - #### NavMagazine
121
- ##### Props
122
- - logo
123
- - dataObject
124
- - #### NavNative
125
- ##### Props
126
- - logo
127
- - dataObject
128
- - #### NavNormal
129
- ##### Props
130
- - logo
131
- - dataObject
132
- - variant
133
- - #### NavDvm
134
- ##### Props
135
- - logo
136
- - dataObject
137
- - subNavHeads
138
-
139
- ### Template Components
140
-
141
- - #### TemplateNormal
142
- ##### Props
143
- - config
144
- - title
145
- - keywords
146
- - description
147
- - website
148
-
149
- ### Ad Components
150
-
151
- - #### AD300x250
152
- - #### AD300x250x600
153
- - #### AD728x90
154
- ##### Common Props
155
- - networkID
156
- - adUnit
157
-
158
- ### Serializers
159
-
160
- - #### getSerializers (function)
161
- ##### arguments
162
- - client
163
- ##### types
164
- - youtube
165
- - figure
166
- - slideshow
167
-
168
- ## License
169
-
170
- MIT © [mjh-framework](https://github.com/mjh-framework)
1
+ # mjh-framework v. 1.0.61
2
+
3
+ > Foundation Framework
4
+
5
+ [![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)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install --save @mjhls/mjh-framework
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```jsx
16
+ import React, { Component } from 'react'
17
+
18
+ import { NavMagazine, DeckQueue } from 'mjh-framework'
19
+
20
+ export default class App extends Component {
21
+ render() {
22
+ return (
23
+ <div>
24
+ <NavMagazine />
25
+ <DeckQueue />
26
+ </div>
27
+ )
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Publish new updates to the npm registry
33
+
34
+ ```bash
35
+ npm publish
36
+ ```
37
+
38
+ ## For getting updates in the template without publishing each time a change is made in the framework
39
+
40
+ Link react and react-dom of the template repo, so that it can be used by the framework.
41
+ This is to avoid the error arising due to multiple instances of React.
42
+
43
+ ```bash
44
+ cd ../mjh-template/node_modules/react
45
+
46
+ yarn link
47
+
48
+ cd ../react-dom
49
+
50
+ yarn link
51
+
52
+ cd ../../../mjh-framework
53
+
54
+ yarn link react && yarn link react-dom
55
+ ```
56
+
57
+ Link the framework repo so that it can be used in the template
58
+
59
+ ```bash
60
+ npm link
61
+
62
+ cd ../mjh-template
63
+
64
+ npm link @mjhls/mjh-framework
65
+ ```
66
+
67
+ ## Components and "props"
68
+
69
+ ### Deck Components
70
+
71
+ - #### DeckContent
72
+
73
+ ##### Props
74
+
75
+ - mapping
76
+ - dataRecord
77
+ - query
78
+ - params
79
+ - pointer
80
+ - pointerArray
81
+ - defaultImage
82
+
83
+ - #### DeckQueue
84
+ ##### Props
85
+ - page
86
+ - dataRecord
87
+ - query
88
+ - params
89
+ - pointer
90
+ - pointerArray
91
+
92
+ ### Layout Components
93
+
94
+ - #### Column1
95
+ - #### Column2
96
+ ##### Props
97
+ - rightItems
98
+ - #### Column3
99
+ ##### Props
100
+ - leftItems
101
+ - rightItems
102
+ ##### Common Props (Column1, Column2, Column3)
103
+ - title
104
+ - children
105
+ - #### Header
106
+ ##### Props
107
+ - title
108
+ - keyword
109
+ - description
110
+ - #### LeftNav
111
+ ##### Props
112
+ - leftItems
113
+ - #### AccordionPanel
114
+ ##### Props
115
+ - accordionClassName
116
+ - data
117
+
118
+ ### Navigation Components
119
+
120
+ - #### NavMagazine
121
+ ##### Props
122
+ - logo
123
+ - dataObject
124
+ - #### NavNative
125
+ ##### Props
126
+ - logo
127
+ - dataObject
128
+ - #### NavNormal
129
+ ##### Props
130
+ - logo
131
+ - dataObject
132
+ - variant
133
+ - #### NavDvm
134
+ ##### Props
135
+ - logo
136
+ - dataObject
137
+ - subNavHeads
138
+
139
+ ### Template Components
140
+
141
+ - #### TemplateNormal
142
+ ##### Props
143
+ - config
144
+ - title
145
+ - keywords
146
+ - description
147
+ - website
148
+
149
+ ### Ad Components
150
+
151
+ - #### AD300x250
152
+ - #### AD300x250x600
153
+ - #### AD728x90
154
+ ##### Common Props
155
+ - networkID
156
+ - adUnit
157
+
158
+ ### Serializers
159
+
160
+ - #### getSerializers (function)
161
+ ##### arguments
162
+ - client
163
+ ##### types
164
+ - youtube
165
+ - figure
166
+ - slideshow
167
+
168
+ ## License
169
+
170
+ MIT © [mjh-framework](https://github.com/mjh-framework)
package/dist/index.es.js CHANGED
@@ -5,7 +5,7 @@ import Row from 'react-bootstrap/Row';
5
5
  import Col from 'react-bootstrap/Col';
6
6
  import Card from 'react-bootstrap/Card';
7
7
  import Link from 'next/link';
8
- import { withRouter } from 'next/router';
8
+ import { withRouter, useRouter } from 'next/router';
9
9
  import Media from 'react-bootstrap/Media';
10
10
  import ListGroup from 'react-bootstrap/ListGroup';
11
11
  import Head from 'next/head';
@@ -3894,13 +3894,33 @@ var DeckContent = function (_React$Component) {
3894
3894
 
3895
3895
  var path = router.asPath;
3896
3896
  var qrIndex = path.indexOf('?');
3897
+ var pathname = router.pathname;
3898
+ var queryString = '';
3899
+
3897
3900
  if (qrIndex > 0) {
3898
3901
  path = path.substring(1, qrIndex);
3902
+
3903
+ var partialQS = router.asPath.substring(qrIndex + 1);
3904
+ var partialQSArr = partialQS.split('&');
3905
+
3906
+ // exclude page=xxx from query string
3907
+ partialQSArr.map(function (item) {
3908
+ var itemArr = item.split('=');
3909
+ var key = itemArr[0];
3910
+ var val = itemArr[1];
3911
+
3912
+ if (key !== 'page') {
3913
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
3914
+ }
3915
+ });
3916
+ }
3917
+
3918
+ if (queryString.length > 0) {
3919
+ path += '?' + queryString;
3899
3920
  }
3900
3921
 
3901
3922
  pageNumber = parseInt(pageNumber);
3902
3923
 
3903
- var newPath = pageNumber === 1 ? '' + path : '?page=' + pageNumber;
3904
3924
  if (currentPage !== pageNumber) {
3905
3925
 
3906
3926
  lib_3.refresh();
@@ -3908,12 +3928,31 @@ var DeckContent = function (_React$Component) {
3908
3928
  _this.setState({
3909
3929
  currentPage: pageNumber
3910
3930
  }, function () {
3931
+ if (path[0] !== '/') {
3932
+ path = '/' + path;
3933
+ }
3934
+
3935
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
3936
+
3937
+ // please leave this for later debug purpose : Yong Jun.
3938
+ /*console.log('page change reported', {
3939
+ currentPage: currentPage,
3940
+ pageNumber: pageNumber,
3941
+ pathname: pathname,
3942
+ path: path,
3943
+ newPath: newPath,
3944
+ firstPage: pageNumber === 1,
3945
+ queryString: queryString
3946
+ })*/
3947
+
3911
3948
  pageview(newPath);
3949
+
3950
+ router.push(pathname, newPath, {
3951
+ shallow: true
3952
+ });
3912
3953
  });
3913
3954
  }
3914
3955
  }
3915
-
3916
- window.history.pushState(newPath, '', newPath);
3917
3956
  }
3918
3957
  }, _this.cardLoader = function (page, columns, variant) {
3919
3958
  var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
@@ -5428,15 +5467,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
5428
5467
  );
5429
5468
  };
5430
5469
 
5431
- /*
5432
- GROQ query -
5433
- *[_type == "article" && references(*[_type == 'documentGroup' && name == 'test']._id)][0...10]{
5434
- title,
5435
- published,
5436
- "thumbnail": thumbnail.asset->url,
5437
- "url": url.current
5438
- }
5439
-
5470
+ /*
5471
+ GROQ query -
5472
+ *[_type == "article" && references(*[_type == 'documentGroup' && name == 'test']._id)][0...10]{
5473
+ title,
5474
+ published,
5475
+ "thumbnail": thumbnail.asset->url,
5476
+ "url": url.current
5477
+ }
5478
+
5440
5479
  */
5441
5480
  var GroupDeck = function GroupDeck(props) {
5442
5481
  // Props should be an array of objects containing Thumbnail, title, and URL
@@ -6195,8 +6234,9 @@ var Search = function Search(_ref) {
6195
6234
  var _ref$placeholder = _ref.placeholder,
6196
6235
  placeholder = _ref$placeholder === undefined ? 'Search' : _ref$placeholder,
6197
6236
  _ref$btnText = _ref.btnText,
6198
- btnText = _ref$btnText === undefined ? 'Search' : _ref$btnText,
6199
- router = _ref.router;
6237
+ btnText = _ref$btnText === undefined ? 'Search' : _ref$btnText;
6238
+
6239
+ var router = useRouter();
6200
6240
 
6201
6241
  var _useState = useState(''),
6202
6242
  _useState2 = slicedToArray(_useState, 2),
@@ -6231,8 +6271,6 @@ var Search = function Search(_ref) {
6231
6271
  );
6232
6272
  };
6233
6273
 
6234
- var Search$1 = withRouter(Search);
6235
-
6236
6274
  var NavDvm = function NavDvm(props) {
6237
6275
  var logo = props.logo,
6238
6276
  mobileLogo = props.mobileLogo,
@@ -6327,7 +6365,7 @@ var NavDvm = function NavDvm(props) {
6327
6365
  }
6328
6366
  })
6329
6367
  ),
6330
- React__default.createElement(Search$1, null)
6368
+ React__default.createElement(Search, null)
6331
6369
  )
6332
6370
  )
6333
6371
  ),
@@ -10068,7 +10106,15 @@ var YouTubePlayer$1 = function YouTubePlayer(_ref) {
10068
10106
  var url = _ref.url;
10069
10107
 
10070
10108
  var id = getYoutubeId(url);
10071
- return React__default.createElement(YouTube, { videoId: id, opts: { width: '100%' } });
10109
+
10110
+ var opts = {
10111
+ width: '100%',
10112
+ playerVars: {
10113
+ rel: 0
10114
+ }
10115
+ };
10116
+
10117
+ return React__default.createElement(YouTube, { videoId: id, opts: opts });
10072
10118
  };
10073
10119
 
10074
10120
  /*
@@ -11114,5 +11160,5 @@ var getSerializers$1 = function getSerializers(client) {
11114
11160
  };
11115
11161
  };
11116
11162
 
11117
- export { ContentCard as DeckContent, DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD300x250, AD300x250x600, AD728x90, getSerializers$1 as getSerializers, Search$1 as Search };
11163
+ export { ContentCard as DeckContent, DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD300x250, AD300x250x600, AD728x90, getSerializers$1 as getSerializers, Search };
11118
11164
  //# sourceMappingURL=index.es.js.map