@quintype/native-components 2.19.7 → 2.19.8
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.19.8](https://github.com/quintype/native-components/compare/v2.19.7...v2.19.8) (2022-01-10)
|
|
6
|
+
|
|
5
7
|
### [2.19.7](https://github.com/quintype/native-components/compare/v2.19.0...v2.19.7) (2022-01-07)
|
|
6
8
|
|
|
7
9
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { get, throttle } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React, { useContext, memo } from
|
|
4
|
-
import { StyleSheet, TouchableOpacity, View } from
|
|
5
|
-
import Icon from
|
|
1
|
+
import { get, throttle } from "lodash";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React, { useContext, memo } from "react";
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View } from "react-native";
|
|
5
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
6
6
|
import {
|
|
7
7
|
AppTheme,
|
|
8
8
|
getImageMetadata,
|
|
@@ -12,15 +12,12 @@ import {
|
|
|
12
12
|
import { getStoryHeadline } from "../../utils/story";
|
|
13
13
|
import { ResponsiveImage, Text } from "../index";
|
|
14
14
|
import { storyStyles } from "./styles";
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
17
16
|
|
|
18
17
|
const PrimaryStoryCardNewBase = (props) => {
|
|
19
18
|
const { story = {} } = props;
|
|
20
19
|
const { theme } = useContext(AppTheme);
|
|
21
|
-
const {
|
|
22
|
-
COLORS, FONT_SIZE, locale, DARK_MODE,
|
|
23
|
-
} = theme || {};
|
|
20
|
+
const { COLORS, FONT_SIZE, locale, DARK_MODE } = theme || {};
|
|
24
21
|
|
|
25
22
|
const translate = get(theme, ["translate"], (word) => word);
|
|
26
23
|
|
|
@@ -58,14 +55,14 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
58
55
|
</View>
|
|
59
56
|
);
|
|
60
57
|
const showStoryType = () => {
|
|
61
|
-
switch (story[
|
|
62
|
-
case
|
|
58
|
+
switch (story["story-template"]) {
|
|
59
|
+
case "text":
|
|
63
60
|
return null;
|
|
64
|
-
case
|
|
65
|
-
return showIcon(
|
|
66
|
-
case
|
|
67
|
-
return showIcon(
|
|
68
|
-
case
|
|
61
|
+
case "photo":
|
|
62
|
+
return showIcon("photo");
|
|
63
|
+
case "video":
|
|
64
|
+
return showIcon("play");
|
|
65
|
+
case "live-blog":
|
|
69
66
|
return showLiveBlogIcon();
|
|
70
67
|
default:
|
|
71
68
|
null;
|
|
@@ -74,7 +71,7 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
74
71
|
|
|
75
72
|
return (
|
|
76
73
|
<TouchableOpacity
|
|
77
|
-
testID=
|
|
74
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryCard}
|
|
78
75
|
onPress={throttledOnpress}
|
|
79
76
|
activeOpacity={0.8}
|
|
80
77
|
style={containerStyle}
|
|
@@ -94,15 +91,21 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
94
91
|
numberOfLines={3}
|
|
95
92
|
ellipsizeMode="tail"
|
|
96
93
|
style={headlineStyle}
|
|
97
|
-
testID=
|
|
94
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
|
|
98
95
|
>
|
|
99
96
|
{getStoryHeadline(story)}
|
|
100
97
|
</Text>
|
|
101
98
|
<View style={styles.timestampContainer}>
|
|
102
99
|
{readTime ? (
|
|
103
|
-
<Text
|
|
100
|
+
<Text
|
|
101
|
+
style={timestampStyle}
|
|
102
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryReadTime}
|
|
103
|
+
>{`${readTime} · `}</Text>
|
|
104
104
|
) : null}
|
|
105
|
-
<Text
|
|
105
|
+
<Text
|
|
106
|
+
style={timestampStyle}
|
|
107
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryPubishedAt}
|
|
108
|
+
>
|
|
106
109
|
{getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
|
|
107
110
|
</Text>
|
|
108
111
|
</View>
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
View,
|
|
9
9
|
TextStyle,
|
|
10
10
|
TouchableOpacityProps,
|
|
11
|
-
} from
|
|
12
|
-
import Icon from
|
|
11
|
+
} from "react-native";
|
|
12
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
13
13
|
import {
|
|
14
14
|
AppTheme,
|
|
15
15
|
getImageMetadata,
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { getStoryHeadline } from "../../utils/story";
|
|
20
20
|
import { ResponsiveImage, Text } from "../index";
|
|
21
21
|
import { storyStyles } from "./styles";
|
|
22
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
22
23
|
|
|
23
24
|
const SecondaryStoryCardNewBase = (props) => {
|
|
24
25
|
const { story = {} } = props;
|
|
@@ -62,14 +63,14 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
const showStoryType = () => {
|
|
65
|
-
switch (story[
|
|
66
|
-
case
|
|
66
|
+
switch (story["story-template"]) {
|
|
67
|
+
case "text":
|
|
67
68
|
return null;
|
|
68
|
-
case
|
|
69
|
-
return showIcon(
|
|
70
|
-
case
|
|
71
|
-
return showIcon(
|
|
72
|
-
case
|
|
69
|
+
case "photo":
|
|
70
|
+
return showIcon("photo");
|
|
71
|
+
case "video":
|
|
72
|
+
return showIcon("play");
|
|
73
|
+
case "live-blog":
|
|
73
74
|
return showLiveBlogIcon();
|
|
74
75
|
default:
|
|
75
76
|
null;
|
|
@@ -78,7 +79,7 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<TouchableOpacity
|
|
81
|
-
testID={
|
|
82
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
|
|
82
83
|
onPress={throttledOnpress}
|
|
83
84
|
activeOpacity={0.8}
|
|
84
85
|
style={containerStyle}
|
|
@@ -97,15 +98,21 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
97
98
|
numberOfLines={2}
|
|
98
99
|
ellipsizeMode="tail"
|
|
99
100
|
style={headlineStyle}
|
|
100
|
-
testID=
|
|
101
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
|
|
101
102
|
>
|
|
102
103
|
{getStoryHeadline(story)?.trim()}
|
|
103
104
|
</Text>
|
|
104
105
|
<View style={styles.timestampContainer}>
|
|
105
106
|
{readTime ? (
|
|
106
|
-
<Text
|
|
107
|
+
<Text
|
|
108
|
+
style={timestampStyle}
|
|
109
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryReadTime}
|
|
110
|
+
>{`${readTime} · `}</Text>
|
|
107
111
|
) : null}
|
|
108
|
-
<Text
|
|
112
|
+
<Text
|
|
113
|
+
style={timestampStyle}
|
|
114
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryPubishedAt}
|
|
115
|
+
>
|
|
109
116
|
{getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
|
|
110
117
|
</Text>
|
|
111
118
|
</View>
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
export const COMP_GENERAL_CONSTANTS = {
|
|
2
|
-
secondaryStoryCard:
|
|
3
|
-
primaryStoryCard:
|
|
4
|
-
secondaryStoryAuthor:
|
|
5
|
-
secondaryStoryPubishedAt:
|
|
6
|
-
primaryStoryAuthor:
|
|
7
|
-
primaryStoryPubishedAt:
|
|
8
|
-
secondaryStoryHeadline:
|
|
9
|
-
primaryStoryHeadline:
|
|
10
|
-
iconTextTouch:
|
|
11
|
-
iconTextLabel:
|
|
12
|
-
collectionTitleTouch:
|
|
13
|
-
collectionTitleText:
|
|
14
|
-
backNavigatorText:
|
|
15
|
-
backNavigatorTouch:
|
|
16
|
-
customSwitch:
|
|
2
|
+
secondaryStoryCard: 'COMP_GENERAL_SECONDARY_STORY',
|
|
3
|
+
primaryStoryCard: 'COMP_GENERAL_PRIMARY_STORY',
|
|
4
|
+
secondaryStoryAuthor: 'COMP_GENERAL_SECONDARY_STORY_AUTHOR',
|
|
5
|
+
secondaryStoryPubishedAt: 'COMP_GENERAL_SECONDARY_STORY_PUBLISHEDATE',
|
|
6
|
+
primaryStoryAuthor: 'COMP_GENERAL_PRIMARY_STORY_AUTHOR',
|
|
7
|
+
primaryStoryPubishedAt: 'COMP_GENERAL_PRIMARY_STORY_PUBLISHEDATE',
|
|
8
|
+
secondaryStoryHeadline: 'COMP_GENERAL_SECONDARY_STORY_HEADLINE',
|
|
9
|
+
primaryStoryHeadline: 'COMP_GENERAL_PRIMARY_STORY_HEADLINE',
|
|
10
|
+
iconTextTouch: 'COMP_GENERAL_ICON_TEXT_TOUCH',
|
|
11
|
+
iconTextLabel: 'COMP_GENERAL_ICON_TEXT_LABEL',
|
|
12
|
+
collectionTitleTouch: 'COMP_GENERAL_COLLECTION_TITLE',
|
|
13
|
+
collectionTitleText: 'COMP_GENERAL_COLLECTION_TITLE_TEXT',
|
|
14
|
+
backNavigatorText: 'COMP_GENERAL_BACK_NAVIGATOR_TEXT',
|
|
15
|
+
backNavigatorTouch: 'COMP_GENERAL_BACK_NAVIGATOR_TOUCH',
|
|
16
|
+
customSwitch: 'COMP_GENERAL_CUSTOM_SWITCH',
|
|
17
|
+
primaryStoryReadTime: 'COMP_GENERAL_PRIMARY_STORY_READTIME',
|
|
18
|
+
secondaryStoryReadTime: 'COMP_GENERAL_SECONDARY_STORY_READTIME',
|
|
17
19
|
};
|