@quintype/components 3.4.7-test-version.0 → 3.5.0
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/cjs/index.js
CHANGED
|
@@ -1055,6 +1055,21 @@ function _isNativeReflectConstruct$l() { if (typeof Reflect === "undefined" || !
|
|
|
1055
1055
|
* onItemFocus={(item) => console.log(`Story In View: ${item.story.headline}`)}
|
|
1056
1056
|
* doNotChangeUrl={true} />
|
|
1057
1057
|
* ```
|
|
1058
|
+
*
|
|
1059
|
+
* #### Configuring the the url to change
|
|
1060
|
+
* When a story is focussed, the url is changed to the original slug of the story by default. To configure this, pass a prop called changeUrlTo as a function which returns the desired url.
|
|
1061
|
+
* This is typically used when you want to change the url but not to the original slug.
|
|
1062
|
+
*
|
|
1063
|
+
* Example:
|
|
1064
|
+
* ```javascript
|
|
1065
|
+
* <InfiniteStoryBase {...props}
|
|
1066
|
+
* render={StoryPageBase}
|
|
1067
|
+
* loadItems={storyPageLoadItems}
|
|
1068
|
+
* onItemFocus={(item) => console.log(`Story In View: ${item.story.headline}`)}
|
|
1069
|
+
changeUrlTo={(item) => item.currentPath || props.currentPath}
|
|
1070
|
+
* doNotChangeUrl={true} />
|
|
1071
|
+
* ```
|
|
1072
|
+
*
|
|
1058
1073
|
* @component
|
|
1059
1074
|
* @category Story Page
|
|
1060
1075
|
*/
|
|
@@ -1095,7 +1110,8 @@ var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1095
1110
|
var storyPath = item.story.url ? new URL(item.story.url).pathname : "/" + item.story.slug;
|
|
1096
1111
|
var metaTitle = get__default["default"](item, ['story', 'seo', 'meta-title'], item.story.headline);
|
|
1097
1112
|
var title = get__default["default"](item, ["customSeo", "title"], metaTitle);
|
|
1098
|
-
|
|
1113
|
+
var path = this.props.changeUrlTo ? this.props.changeUrlTo(item) : storyPath;
|
|
1114
|
+
global.app.maybeSetUrl(path, title);
|
|
1099
1115
|
}
|
|
1100
1116
|
|
|
1101
1117
|
this.props.onItemFocus && this.props.onItemFocus(item, index);
|
|
@@ -56,6 +56,21 @@ import { removeDuplicateStories } from '../utils';
|
|
|
56
56
|
* onItemFocus={(item) => console.log(`Story In View: ${item.story.headline}`)}
|
|
57
57
|
* doNotChangeUrl={true} />
|
|
58
58
|
* ```
|
|
59
|
+
*
|
|
60
|
+
* #### Configuring the the url to change
|
|
61
|
+
* When a story is focussed, the url is changed to the original slug of the story by default. To configure this, pass a prop called changeUrlTo as a function which returns the desired url.
|
|
62
|
+
* This is typically used when you want to change the url but not to the original slug.
|
|
63
|
+
*
|
|
64
|
+
* Example:
|
|
65
|
+
* ```javascript
|
|
66
|
+
* <InfiniteStoryBase {...props}
|
|
67
|
+
* render={StoryPageBase}
|
|
68
|
+
* loadItems={storyPageLoadItems}
|
|
69
|
+
* onItemFocus={(item) => console.log(`Story In View: ${item.story.headline}`)}
|
|
70
|
+
changeUrlTo={(item) => item.currentPath || props.currentPath}
|
|
71
|
+
* doNotChangeUrl={true} />
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
59
74
|
* @component
|
|
60
75
|
* @category Story Page
|
|
61
76
|
*/
|
|
@@ -96,7 +111,8 @@ export var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
|
|
|
96
111
|
var storyPath = item.story.url ? new URL(item.story.url).pathname : "/" + item.story.slug;
|
|
97
112
|
var metaTitle = get(item, ['story', 'seo', 'meta-title'], item.story.headline);
|
|
98
113
|
var title = get(item, ["customSeo", "title"], metaTitle);
|
|
99
|
-
|
|
114
|
+
var path = this.props.changeUrlTo ? this.props.changeUrlTo(item) : storyPath;
|
|
115
|
+
global.app.maybeSetUrl(path, title);
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
this.props.onItemFocus && this.props.onItemFocus(item, index);
|