@quintype/native-components 2.19.3 → 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 +21 -0
- package/package.json +5 -5
- package/src/Icons/ClockIcon/index.js +9 -5
- package/src/components/AlsoRead/index.js +3 -3
- package/src/components/AuthorRow/index.js +2 -2
- package/src/components/BackNavigator/styles.js +2 -0
- package/src/components/CustomSwitch/index.js +16 -9
- package/src/components/PrimaryStoryCard/index.js +3 -3
- package/src/components/PrimaryStoryCardNew/index.js +36 -29
- package/src/components/RelatedStoriesCard/index.js +9 -6
- package/src/components/RelatedStoriesCard/styles.js +3 -2
- package/src/components/SecondaryStoryCard/index.js +2 -3
- package/src/components/SecondaryStoryCardNew/index.js +37 -26
- package/src/components/StoryHeader/index.js +5 -7
- package/src/components/StoryHeader/styles.js +1 -1
- package/src/components/StoryImage/index.js +1 -1
- package/src/components/StoryText/index.js +3 -1
- package/src/components/Table/index.js +1 -1
- package/src/components/Table/styles.js +5 -2
- package/src/components/TextQandA/styles.js +3 -4
- package/src/constants/component-constants/general-constants/constants.js +3 -0
- package/src/constants/renderHTML.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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
|
+
|
|
7
|
+
### [2.19.7](https://github.com/quintype/native-components/compare/v2.19.0...v2.19.7) (2022-01-07)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **AlsoRead:** Changed dark-mode color for the text :hammer: ([#170](https://github.com/quintype/native-components/issues/170)) ([67f1e61](https://github.com/quintype/native-components/commit/67f1e61fd4b76ea6fa65f565006214981d0bb8a8))
|
|
13
|
+
* **AlsoRead:** Fixed card height :hammer: ([#174](https://github.com/quintype/native-components/issues/174)) ([6ce7a60](https://github.com/quintype/native-components/commit/6ce7a6078ec699f0f3df74d8136fc64070921caa))
|
|
14
|
+
* **Navigator:** Fixed Section title text overflow :hammer: ([#176](https://github.com/quintype/native-components/issues/176)) ([249672b](https://github.com/quintype/native-components/commit/249672b44f6559190e930fc78a11d83a8e94c009))
|
|
15
|
+
* **old-UI:** Fixes all padding/image-aspect-ratio inconsistencies 🔨 ([#169](https://github.com/quintype/native-components/issues/169)) ([f3b8850](https://github.com/quintype/native-components/commit/f3b88507c02985ff83aadd266e0dbd04438fd441))
|
|
16
|
+
|
|
17
|
+
### [2.19.6](https://github.com/quintype/native-components/compare/v2.19.5...v2.19.6) (2021-12-30)
|
|
18
|
+
|
|
19
|
+
### [2.19.5](https://github.com/quintype/native-components/compare/v2.19.3...v2.19.5) (2021-12-29)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **Navigator:** Fixed Section title text overflow :hammer: ([#176](https://github.com/quintype/native-components/issues/176)) ([249672b](https://github.com/quintype/native-components/commit/249672b44f6559190e930fc78a11d83a8e94c009))
|
|
25
|
+
|
|
5
26
|
### [2.19.3](https://github.com/quintype/native-components/compare/v2.18.4...v2.19.3) (2021-10-28)
|
|
6
27
|
|
|
7
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"rn-fetch-blob": "^0.10.16"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
+
"@react-navigation/native": ">=5.7.3",
|
|
32
|
+
"lodash": ">=4.17.20",
|
|
31
33
|
"react": ">=16.13.1",
|
|
32
34
|
"react-native": ">=0.63.2",
|
|
33
35
|
"react-native-fast-image": ">=8.3.2",
|
|
34
|
-
"react-native-webview": ">=10.6.0",
|
|
35
36
|
"react-native-pdf": ">=6.2.0",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"lodash": ">=4.17.20"
|
|
37
|
+
"react-native-webview": ">=10.6.0",
|
|
38
|
+
"rn-fetch-blob": ">=0.12.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/core": "^7.11.1",
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
import { AppTheme } from "../../utils/context";
|
|
3
4
|
|
|
4
|
-
export const ClockIcon = (props) =>
|
|
5
|
-
|
|
5
|
+
export const ClockIcon = (props) => {
|
|
6
|
+
const { theme } = useContext(AppTheme);
|
|
7
|
+
const { COLORS } = theme;
|
|
8
|
+
const color = COLORS.BRAND_BLACK;
|
|
9
|
+
return <Svg width={24} height={24} {...props}>
|
|
6
10
|
<Path
|
|
7
|
-
fill=
|
|
11
|
+
fill={color}
|
|
8
12
|
d="M12 4.25c1.396 0 2.687.349 3.875 1.047a7.831 7.831 0 012.828 2.828A7.513 7.513 0 0119.75 12a7.513 7.513 0 01-1.047 3.875 7.831 7.831 0 01-2.828 2.828A7.513 7.513 0 0112 19.75a7.513 7.513 0 01-3.875-1.047 7.831 7.831 0 01-2.828-2.828A7.513 7.513 0 014.25 12c0-1.396.349-2.687 1.047-3.875a7.831 7.831 0 012.828-2.828A7.513 7.513 0 0112 4.25zM18.75 12a6.58 6.58 0 00-.906-3.39 6.72 6.72 0 00-2.469-2.454 6.641 6.641 0 00-3.39-.906 6.558 6.558 0 00-3.376.906 6.72 6.72 0 00-2.453 2.469 6.641 6.641 0 00-.906 3.39c0 1.22.302 2.344.906 3.376a6.72 6.72 0 002.469 2.453 6.641 6.641 0 003.39.906 6.558 6.558 0 003.376-.906 6.72 6.72 0 002.453-2.469A6.613 6.613 0 0018.75 12zm-4.656 2.75l-2.532-1.844a.307.307 0 01-.156-.281v-5c0-.104.037-.193.11-.266a.362.362 0 01.265-.109h.438c.104 0 .192.036.265.11.073.072.11.16.11.265v4.563l2.218 1.625a.33.33 0 01.141.234.349.349 0 01-.038.202l-.29.439a.342.342 0 01-.25.14.389.389 0 01-.281-.078z"
|
|
9
13
|
/>
|
|
10
14
|
</Svg>
|
|
11
|
-
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
|
-
import { View, TouchableOpacity
|
|
3
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
4
4
|
import { ResponsiveImage, Text } from '../index';
|
|
5
5
|
import { alsoReadStyles } from './styles';
|
|
6
6
|
import { FallbackIcon } from '../../Icons/FallBackIcon';
|
|
@@ -25,7 +25,7 @@ export const AlsoRead = (props) => {
|
|
|
25
25
|
const linkedImage = get(linkedStories, [linkedStoryId, 'hero-image-s3-key']);
|
|
26
26
|
|
|
27
27
|
const { theme } = useContext(AppTheme);
|
|
28
|
-
const { COLORS, FONT_SIZE, DARK_MODE, CustomFallBackIcon } = theme;
|
|
28
|
+
const { COLORS, FONT_SIZE, DARK_MODE, CustomFallBackIcon ,translate} = theme;
|
|
29
29
|
const styles = alsoReadStyles(COLORS, FONT_SIZE, DARK_MODE);
|
|
30
30
|
|
|
31
31
|
const fallBackIcon = CustomFallBackIcon ? <CustomFallBackIcon /> : <FallbackIcon />;
|
|
@@ -57,7 +57,7 @@ export const AlsoRead = (props) => {
|
|
|
57
57
|
<View style={styles.container}>
|
|
58
58
|
{getImageComponent()}
|
|
59
59
|
<View style={styles.alsoReadContentWrapper}>
|
|
60
|
-
<Text style={styles.alsoReadText}>Also Read</Text>
|
|
60
|
+
<Text style={styles.alsoReadText}>{translate("Also Read")}</Text>
|
|
61
61
|
<Text primary numberOfLines={2} style={styles.alsoReadTitle}>
|
|
62
62
|
{text}
|
|
63
63
|
</Text>
|
|
@@ -20,7 +20,7 @@ export const AuthorRow = ({
|
|
|
20
20
|
disablePress,
|
|
21
21
|
}) => {
|
|
22
22
|
const { theme } = useContext(AppTheme);
|
|
23
|
-
const { COLORS } = theme;
|
|
23
|
+
const { COLORS ,translate} = theme;
|
|
24
24
|
const styles = authorRowStyleSheet(theme);
|
|
25
25
|
|
|
26
26
|
return (
|
|
@@ -69,7 +69,7 @@ export const AuthorRow = ({
|
|
|
69
69
|
})}
|
|
70
70
|
{readtime ? (
|
|
71
71
|
<View style={styles.readtimeComponent}>
|
|
72
|
-
<Text style={styles.readtime}>{`| ${readtime} min read`}</Text>
|
|
72
|
+
<Text style={styles.readtime}>{`| ${readtime} ${translate("min read")}`}</Text>
|
|
73
73
|
</View>
|
|
74
74
|
) : null}
|
|
75
75
|
</View>
|
|
@@ -6,6 +6,7 @@ export const backNavigatorStyles = (appThemeContext) => {
|
|
|
6
6
|
container: {
|
|
7
7
|
flexDirection: 'row',
|
|
8
8
|
justifyContent: 'flex-start',
|
|
9
|
+
marginRight: 20,
|
|
9
10
|
alignItems: 'center',
|
|
10
11
|
backgroundColor: DARK_MODE ? COLORS.MONO6 : COLORS.BRAND_WHITE,
|
|
11
12
|
},
|
|
@@ -29,6 +30,7 @@ export const backNavigatorStyles = (appThemeContext) => {
|
|
|
29
30
|
text: {
|
|
30
31
|
marginLeft: 10,
|
|
31
32
|
opacity: 0.9,
|
|
33
|
+
flexShrink: 1,
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
};
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import React, { useContext, useState } from
|
|
2
|
-
import { Switch, View } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import Icon from
|
|
5
|
-
import { Text } from
|
|
6
|
-
import { AppTheme } from
|
|
7
|
-
import { customSwitchStyles } from
|
|
1
|
+
import React, { useContext, useState } from "react";
|
|
2
|
+
import { Switch, View } from "react-native";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
5
|
+
import { Text } from "../Text";
|
|
6
|
+
import { AppTheme } from "../../utils";
|
|
7
|
+
import { customSwitchStyles } from "./styles";
|
|
8
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
8
9
|
|
|
9
10
|
export const CustomSwitch = ({
|
|
10
|
-
label =
|
|
11
|
+
label = "",
|
|
12
|
+
callback,
|
|
13
|
+
isEnabled = true,
|
|
14
|
+
iconSize = 20,
|
|
15
|
+
iconName,
|
|
16
|
+
isSwitchDisabled = false,
|
|
11
17
|
}) => {
|
|
12
18
|
const { theme } = useContext(AppTheme);
|
|
13
19
|
const { COLORS } = theme;
|
|
14
20
|
const styles = customSwitchStyles();
|
|
15
21
|
const handleToggle = () => {
|
|
16
|
-
typeof callback ===
|
|
22
|
+
typeof callback === "function" && callback(!isEnabled);
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
return (
|
|
@@ -34,6 +40,7 @@ export const CustomSwitch = ({
|
|
|
34
40
|
onValueChange={handleToggle}
|
|
35
41
|
value={isEnabled}
|
|
36
42
|
disabled={isSwitchDisabled}
|
|
43
|
+
testID={COMP_GENERAL_CONSTANTS.customSwitch}
|
|
37
44
|
/>
|
|
38
45
|
</View>
|
|
39
46
|
);
|
|
@@ -3,7 +3,7 @@ import get from 'lodash/get';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
StyleSheet, TouchableOpacity, View,
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
9
9
|
import {
|
|
@@ -25,7 +25,7 @@ export const PrimaryStoryCard = (props) => {
|
|
|
25
25
|
|
|
26
26
|
const { COLORS, FONT_SIZE, locale } = theme || {};
|
|
27
27
|
|
|
28
|
-
const DATE_FORMAT =
|
|
28
|
+
const DATE_FORMAT = 'd MMM, yyyy';
|
|
29
29
|
|
|
30
30
|
const styles = storyStyles(COLORS, FONT_SIZE);
|
|
31
31
|
const containerStyle = StyleSheet.flatten([
|
|
@@ -43,7 +43,7 @@ export const PrimaryStoryCard = (props) => {
|
|
|
43
43
|
|
|
44
44
|
const name = get(story.authors, [0, 'name']);
|
|
45
45
|
const authorName = name ? `${translate('By')} ${name} | ` : '';
|
|
46
|
-
const readTime = story['read-time'] ? `${story['read-time']} min read` : '';
|
|
46
|
+
const readTime = story['read-time'] ? `${story['read-time']} ${translate('min read')}` : '';
|
|
47
47
|
|
|
48
48
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
49
49
|
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { throttle } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React, { useContext, memo } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
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";
|
|
8
6
|
import {
|
|
9
7
|
AppTheme,
|
|
10
8
|
getImageMetadata,
|
|
11
9
|
getImageSlug,
|
|
12
10
|
getTimeForStoryCards,
|
|
13
|
-
} from
|
|
14
|
-
import { getStoryHeadline } from
|
|
15
|
-
import { ResponsiveImage, Text } from
|
|
16
|
-
import { storyStyles } from
|
|
11
|
+
} from "../../utils";
|
|
12
|
+
import { getStoryHeadline } from "../../utils/story";
|
|
13
|
+
import { ResponsiveImage, Text } from "../index";
|
|
14
|
+
import { storyStyles } from "./styles";
|
|
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
|
-
|
|
23
|
-
|
|
20
|
+
const { COLORS, FONT_SIZE, locale, DARK_MODE } = theme || {};
|
|
21
|
+
|
|
22
|
+
const translate = get(theme, ["translate"], (word) => word);
|
|
24
23
|
|
|
25
24
|
const styles = storyStyles(COLORS, FONT_SIZE, DARK_MODE);
|
|
26
25
|
const containerStyle = StyleSheet.flatten([
|
|
@@ -36,8 +35,10 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
36
35
|
props.timestampStyle,
|
|
37
36
|
]);
|
|
38
37
|
|
|
39
|
-
const DATE_FORMAT =
|
|
40
|
-
const readTime = story[
|
|
38
|
+
const DATE_FORMAT = "d MMM, yyyy";
|
|
39
|
+
const readTime = story["read-time"]
|
|
40
|
+
? `${story["read-time"]} ${translate("min read")}`
|
|
41
|
+
: "";
|
|
41
42
|
|
|
42
43
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
43
44
|
|
|
@@ -54,14 +55,14 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
54
55
|
</View>
|
|
55
56
|
);
|
|
56
57
|
const showStoryType = () => {
|
|
57
|
-
switch (story[
|
|
58
|
-
case
|
|
58
|
+
switch (story["story-template"]) {
|
|
59
|
+
case "text":
|
|
59
60
|
return null;
|
|
60
|
-
case
|
|
61
|
-
return showIcon(
|
|
62
|
-
case
|
|
63
|
-
return showIcon(
|
|
64
|
-
case
|
|
61
|
+
case "photo":
|
|
62
|
+
return showIcon("photo");
|
|
63
|
+
case "video":
|
|
64
|
+
return showIcon("play");
|
|
65
|
+
case "live-blog":
|
|
65
66
|
return showLiveBlogIcon();
|
|
66
67
|
default:
|
|
67
68
|
null;
|
|
@@ -70,7 +71,7 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
70
71
|
|
|
71
72
|
return (
|
|
72
73
|
<TouchableOpacity
|
|
73
|
-
testID=
|
|
74
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryCard}
|
|
74
75
|
onPress={throttledOnpress}
|
|
75
76
|
activeOpacity={0.8}
|
|
76
77
|
style={containerStyle}
|
|
@@ -90,16 +91,22 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
90
91
|
numberOfLines={3}
|
|
91
92
|
ellipsizeMode="tail"
|
|
92
93
|
style={headlineStyle}
|
|
93
|
-
testID=
|
|
94
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
|
|
94
95
|
>
|
|
95
96
|
{getStoryHeadline(story)}
|
|
96
97
|
</Text>
|
|
97
98
|
<View style={styles.timestampContainer}>
|
|
98
99
|
{readTime ? (
|
|
99
|
-
<Text
|
|
100
|
+
<Text
|
|
101
|
+
style={timestampStyle}
|
|
102
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryReadTime}
|
|
103
|
+
>{`${readTime} · `}</Text>
|
|
100
104
|
) : null}
|
|
101
|
-
<Text
|
|
102
|
-
{
|
|
105
|
+
<Text
|
|
106
|
+
style={timestampStyle}
|
|
107
|
+
testID={COMP_GENERAL_CONSTANTS.primaryStoryPubishedAt}
|
|
108
|
+
>
|
|
109
|
+
{getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
|
|
103
110
|
</Text>
|
|
104
111
|
</View>
|
|
105
112
|
</View>
|
|
@@ -121,7 +128,7 @@ PrimaryStoryCardNewBase.propTypes = {
|
|
|
121
128
|
};
|
|
122
129
|
|
|
123
130
|
PrimaryStoryCardNewBase.defaultProps = {
|
|
124
|
-
cdn:
|
|
131
|
+
cdn: "",
|
|
125
132
|
horizontalPadding: 12,
|
|
126
133
|
};
|
|
127
134
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
import { Text, View } from 'react-native';
|
|
4
|
+
import { Text, View ,I18nManager} from 'react-native';
|
|
5
5
|
import { getScreenPercentageWidth, AppTheme } from '../../utils/index';
|
|
6
6
|
import { SecondaryStoryCard, SecondaryStoryCardNew, ShareButton } from '../index';
|
|
7
7
|
|
|
@@ -13,13 +13,16 @@ export const RelatedStoriesCard = ({
|
|
|
13
13
|
cdn,
|
|
14
14
|
stories,
|
|
15
15
|
onStoryPress,
|
|
16
|
-
|
|
16
|
+
collectionTestID,
|
|
17
17
|
RelatedCardID,
|
|
18
|
+
title,
|
|
19
|
+
switchToNewDesign,
|
|
18
20
|
}) => {
|
|
19
21
|
const sliceLimit = 5;
|
|
20
22
|
|
|
21
23
|
const { theme } = useContext(AppTheme);
|
|
22
24
|
const styles = relatedStoriesStyles(theme);
|
|
25
|
+
const titleText = I18nManager.isRTL ? `\u200F${title}` : title;
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<>
|
|
@@ -27,9 +30,7 @@ export const RelatedStoriesCard = ({
|
|
|
27
30
|
style={styles.titleStyle}
|
|
28
31
|
testID={COMP_CONTENT_CONSTANTS.relatedStoriesLabel}
|
|
29
32
|
>
|
|
30
|
-
{
|
|
31
|
-
Related Stories
|
|
32
|
-
{' '}
|
|
33
|
+
{titleText}
|
|
33
34
|
</Text>
|
|
34
35
|
<View style={styles.relatedStoriesContainer} testID={RelatedCardID}>
|
|
35
36
|
{stories.slice(0, sliceLimit).map((currentStory) => {
|
|
@@ -62,6 +63,8 @@ RelatedStoriesCard.propTypes = {
|
|
|
62
63
|
cdn: PropTypes.string.isRequired,
|
|
63
64
|
stories: PropTypes.array.isRequired,
|
|
64
65
|
onStoryPress: PropTypes.func,
|
|
65
|
-
|
|
66
|
+
collectionTestID: PropTypes.string,
|
|
66
67
|
RelatedCardID: PropTypes.string,
|
|
68
|
+
title:PropTypes.string,
|
|
69
|
+
switchToNewDesign: PropTypes.bool,
|
|
67
70
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
1
|
+
import { StyleSheet,I18nManager } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export const relatedStoriesStyles = (appThemeContext) => {
|
|
4
4
|
const { COLORS, FONT_SIZE } = appThemeContext;
|
|
@@ -7,7 +7,8 @@ export const relatedStoriesStyles = (appThemeContext) => {
|
|
|
7
7
|
fontSize: FONT_SIZE.title,
|
|
8
8
|
fontWeight: 'bold',
|
|
9
9
|
color: COLORS.BRAND_BLACK,
|
|
10
|
-
|
|
10
|
+
writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
|
|
11
|
+
paddingHorizontal:5,
|
|
11
12
|
marginVertical: 8,
|
|
12
13
|
},
|
|
13
14
|
relatedStoriesContainer: {
|
|
@@ -3,7 +3,6 @@ import get from 'lodash/get';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import {
|
|
6
|
-
I18nManager,
|
|
7
6
|
Image,
|
|
8
7
|
StyleSheet,
|
|
9
8
|
TouchableOpacity,
|
|
@@ -31,7 +30,7 @@ export const SecondaryStoryCard = (props) => {
|
|
|
31
30
|
const styles = secStoryCardStyles(theme);
|
|
32
31
|
const { story = {} } = props;
|
|
33
32
|
|
|
34
|
-
const DATE_FORMAT =
|
|
33
|
+
const DATE_FORMAT = 'd MMM, yyyy';
|
|
35
34
|
|
|
36
35
|
const containerStyle = StyleSheet.flatten([
|
|
37
36
|
styles.container,
|
|
@@ -52,7 +51,7 @@ export const SecondaryStoryCard = (props) => {
|
|
|
52
51
|
]);
|
|
53
52
|
const name = get(story.authors, [0, 'name']);
|
|
54
53
|
const authorName = name ? `${translate('By')} ${name} | ` : '';
|
|
55
|
-
const readTime = story['read-time'] ? `${story['read-time']} min read` : '';
|
|
54
|
+
const readTime = story['read-time'] ? `${story['read-time']} ${translate('min read')}` : '';
|
|
56
55
|
|
|
57
56
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
58
57
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { throttle } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React, { useContext, memo } from
|
|
1
|
+
import { get, throttle } from "lodash";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React, { useContext, memo } from "react";
|
|
4
4
|
import {
|
|
5
5
|
I18nManager,
|
|
6
6
|
StyleSheet,
|
|
@@ -8,23 +8,26 @@ 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,
|
|
16
16
|
getImageSlug,
|
|
17
17
|
getTimeForStoryCards,
|
|
18
|
-
} from
|
|
19
|
-
import { getStoryHeadline } from
|
|
20
|
-
import { ResponsiveImage, Text } from
|
|
21
|
-
import { storyStyles } from
|
|
18
|
+
} from "../../utils";
|
|
19
|
+
import { getStoryHeadline } from "../../utils/story";
|
|
20
|
+
import { ResponsiveImage, Text } from "../index";
|
|
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;
|
|
25
26
|
const { theme } = useContext(AppTheme);
|
|
26
27
|
const { locale, DARK_MODE, COLORS } = theme;
|
|
27
28
|
|
|
29
|
+
const translate = get(theme, ["translate"], (word) => word);
|
|
30
|
+
|
|
28
31
|
const styles = storyStyles(theme, DARK_MODE);
|
|
29
32
|
const containerStyle = StyleSheet.flatten([
|
|
30
33
|
styles.container,
|
|
@@ -39,8 +42,10 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
39
42
|
props.timestampStyle,
|
|
40
43
|
]);
|
|
41
44
|
|
|
42
|
-
const DATE_FORMAT =
|
|
43
|
-
const readTime = story[
|
|
45
|
+
const DATE_FORMAT = "d MMM, yyyy";
|
|
46
|
+
const readTime = story["read-time"]
|
|
47
|
+
? `${story["read-time"]} ${translate("min read")}`
|
|
48
|
+
: "";
|
|
44
49
|
|
|
45
50
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
46
51
|
|
|
@@ -58,14 +63,14 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
58
63
|
);
|
|
59
64
|
|
|
60
65
|
const showStoryType = () => {
|
|
61
|
-
switch (story[
|
|
62
|
-
case
|
|
66
|
+
switch (story["story-template"]) {
|
|
67
|
+
case "text":
|
|
63
68
|
return null;
|
|
64
|
-
case
|
|
65
|
-
return showIcon(
|
|
66
|
-
case
|
|
67
|
-
return showIcon(
|
|
68
|
-
case
|
|
69
|
+
case "photo":
|
|
70
|
+
return showIcon("photo");
|
|
71
|
+
case "video":
|
|
72
|
+
return showIcon("play");
|
|
73
|
+
case "live-blog":
|
|
69
74
|
return showLiveBlogIcon();
|
|
70
75
|
default:
|
|
71
76
|
null;
|
|
@@ -74,15 +79,15 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
74
79
|
|
|
75
80
|
return (
|
|
76
81
|
<TouchableOpacity
|
|
77
|
-
testID={
|
|
82
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
|
|
78
83
|
onPress={throttledOnpress}
|
|
79
84
|
activeOpacity={0.8}
|
|
80
85
|
style={containerStyle}
|
|
81
86
|
>
|
|
82
87
|
<ResponsiveImage
|
|
83
88
|
metaData={getImageMetadata(story)}
|
|
84
|
-
slug={getImageSlug(story) ||
|
|
85
|
-
cdn={props.cdn ||
|
|
89
|
+
slug={getImageSlug(story) || ""}
|
|
90
|
+
cdn={props.cdn || ""}
|
|
86
91
|
imageWidth={props.imageWidth}
|
|
87
92
|
>
|
|
88
93
|
<View style={styles.storyTypeContainer}>{showStoryType()}</View>
|
|
@@ -93,16 +98,22 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
93
98
|
numberOfLines={2}
|
|
94
99
|
ellipsizeMode="tail"
|
|
95
100
|
style={headlineStyle}
|
|
96
|
-
testID=
|
|
101
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
|
|
97
102
|
>
|
|
98
103
|
{getStoryHeadline(story)?.trim()}
|
|
99
104
|
</Text>
|
|
100
105
|
<View style={styles.timestampContainer}>
|
|
101
106
|
{readTime ? (
|
|
102
|
-
<Text
|
|
107
|
+
<Text
|
|
108
|
+
style={timestampStyle}
|
|
109
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryReadTime}
|
|
110
|
+
>{`${readTime} · `}</Text>
|
|
103
111
|
) : null}
|
|
104
|
-
<Text
|
|
105
|
-
{
|
|
112
|
+
<Text
|
|
113
|
+
style={timestampStyle}
|
|
114
|
+
testID={COMP_GENERAL_CONSTANTS.secondaryStoryPubishedAt}
|
|
115
|
+
>
|
|
116
|
+
{getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
|
|
106
117
|
</Text>
|
|
107
118
|
</View>
|
|
108
119
|
</View>
|
|
@@ -123,7 +134,7 @@ SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
|
|
|
123
134
|
};
|
|
124
135
|
|
|
125
136
|
SecondaryStoryCardNewBase.defaultProps = {
|
|
126
|
-
cdn:
|
|
137
|
+
cdn: "",
|
|
127
138
|
horizontalPadding: 12,
|
|
128
139
|
};
|
|
129
140
|
|
|
@@ -2,7 +2,7 @@ import get from 'lodash/get';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import {
|
|
5
|
-
TouchableOpacity, View, Linking,
|
|
5
|
+
TouchableOpacity, View, Linking,
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
import HTML from 'react-native-render-html';
|
|
8
8
|
import {
|
|
@@ -21,9 +21,7 @@ import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/cont
|
|
|
21
21
|
|
|
22
22
|
import { DailyMotionPlayer } from '../DailyMotionPlayer';
|
|
23
23
|
|
|
24
|
-
const DATE_FORMAT =
|
|
25
|
-
? 'a h:mm ,yyyy d MMMM'
|
|
26
|
-
: 'MMMM d yyyy, h:mm a';
|
|
24
|
+
const DATE_FORMAT = 'd MMMM yyyy h:mm a';
|
|
27
25
|
|
|
28
26
|
const getHeroImage = (cdn, story) => {
|
|
29
27
|
const imageSlug = story['hero-image-s3-key'];
|
|
@@ -71,7 +69,7 @@ export const StoryHeader = (props) => {
|
|
|
71
69
|
const { story } = props;
|
|
72
70
|
const sectionData = get(story, ['sections', 0], {});
|
|
73
71
|
const { theme } = useContext(AppTheme);
|
|
74
|
-
const { COLORS, CAN_COPY_TEXT } = theme;
|
|
72
|
+
const { COLORS, CAN_COPY_TEXT, locale } = theme;
|
|
75
73
|
const styles = storyHeaderStyles(COLORS);
|
|
76
74
|
const imgCaption = story['hero-image-caption'];
|
|
77
75
|
const attri = story['hero-image-attribution'];
|
|
@@ -93,7 +91,7 @@ export const StoryHeader = (props) => {
|
|
|
93
91
|
}}
|
|
94
92
|
/>
|
|
95
93
|
<HTML
|
|
96
|
-
html={
|
|
94
|
+
html={attri}
|
|
97
95
|
textSelectable={CAN_COPY_TEXT}
|
|
98
96
|
key={Math.random()}
|
|
99
97
|
baseFontStyle={styles.attributionStyle}
|
|
@@ -136,7 +134,7 @@ export const StoryHeader = (props) => {
|
|
|
136
134
|
style={styles.dateText}
|
|
137
135
|
testID={COMP_CONTENT_CONSTANTS.publishedDate}
|
|
138
136
|
>
|
|
139
|
-
{getTimeInFormat(story['published-at'], DATE_FORMAT)}
|
|
137
|
+
{getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
|
|
140
138
|
</Text>
|
|
141
139
|
</View>
|
|
142
140
|
<StoryTitle title={story.headline} subTitle={story.subheadline} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import {
|
|
4
|
-
View, StyleSheet, Linking, Text,
|
|
4
|
+
View, StyleSheet, Linking, Text, I18nManager,
|
|
5
5
|
} from 'react-native';
|
|
6
6
|
import HTML from 'react-native-render-html';
|
|
7
7
|
import { AppTheme } from '../../utils/context';
|
|
@@ -21,8 +21,10 @@ export const StoryText = (props) => {
|
|
|
21
21
|
{
|
|
22
22
|
fontFamily: FONT_FAMILY.secondary,
|
|
23
23
|
fontWeight: props.question ? '600' : 'normal',
|
|
24
|
+
writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
|
|
24
25
|
},
|
|
25
26
|
]);
|
|
27
|
+
|
|
26
28
|
const customTagsStyles = customHTMLStyles();
|
|
27
29
|
|
|
28
30
|
return (
|
|
@@ -27,7 +27,7 @@ export const Table = ({ card }) => {
|
|
|
27
27
|
<View style={styles.tableRow}>
|
|
28
28
|
{headerFields.map((headerField) => (
|
|
29
29
|
<View style={styles.tableHeaderTitle}>
|
|
30
|
-
<Text>{data[headerField]}</Text>
|
|
30
|
+
<Text style={styles.tableContect}>{data[headerField]}</Text>
|
|
31
31
|
</View>
|
|
32
32
|
))}
|
|
33
33
|
</View>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
2
|
export const tableStyles = ({ COLORS }) => StyleSheet.create({
|
|
4
3
|
container: {
|
|
5
4
|
flexDirection: 'row',
|
|
@@ -15,6 +14,7 @@ export const tableStyles = ({ COLORS }) => StyleSheet.create({
|
|
|
15
14
|
justifyContent: 'center',
|
|
16
15
|
borderWidth: 0.5,
|
|
17
16
|
borderColor: COLORS.BRAND_4,
|
|
17
|
+
color: COLORS.BRAND_4,
|
|
18
18
|
},
|
|
19
19
|
tableBody: {
|
|
20
20
|
flexDirection: 'column',
|
|
@@ -22,4 +22,7 @@ export const tableStyles = ({ COLORS }) => StyleSheet.create({
|
|
|
22
22
|
tableRow: {
|
|
23
23
|
flexDirection: 'row',
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
tableContect: {
|
|
26
|
+
color: COLORS.BRAND_BLACK,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -8,14 +8,13 @@ export const textQandAStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
|
8
8
|
fontSize: FONT_SIZE.h2,
|
|
9
9
|
fontWeight: '600',
|
|
10
10
|
lineHeight: FONT_SIZE.h2 * 1.3,
|
|
11
|
-
color: COLORS.
|
|
12
|
-
opacity: 0.8
|
|
11
|
+
color: COLORS.BRAND_BLACK,
|
|
12
|
+
opacity: 0.8,
|
|
13
13
|
},
|
|
14
14
|
answerText: {
|
|
15
15
|
fontSize: FONT_SIZE.h2,
|
|
16
16
|
lineHeight: FONT_SIZE.h2 * 1.3,
|
|
17
|
-
color: COLORS.BRAND_8,
|
|
18
17
|
color: COLORS.BRAND_BLACK,
|
|
19
|
-
opacity: 0.8
|
|
18
|
+
opacity: 0.8,
|
|
20
19
|
},
|
|
21
20
|
});
|
|
@@ -13,4 +13,7 @@ export const COMP_GENERAL_CONSTANTS = {
|
|
|
13
13
|
collectionTitleText: 'COMP_GENERAL_COLLECTION_TITLE_TEXT',
|
|
14
14
|
backNavigatorText: 'COMP_GENERAL_BACK_NAVIGATOR_TEXT',
|
|
15
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',
|
|
16
19
|
};
|
|
@@ -59,5 +59,15 @@ export const customHTMLStyles = () => {
|
|
|
59
59
|
color: COLORS.BRAND_BLACK,
|
|
60
60
|
opacity: 0.85,
|
|
61
61
|
},
|
|
62
|
+
sup: {
|
|
63
|
+
marginBottom: 16,
|
|
64
|
+
lineHeight: FONT_SIZE.p1 * 0.3,
|
|
65
|
+
fontSize: FONT_SIZE.p1 * 0.5,
|
|
66
|
+
},
|
|
67
|
+
sub: {
|
|
68
|
+
marginBottom: 16,
|
|
69
|
+
lineHeight: FONT_SIZE.p1 * 0.3,
|
|
70
|
+
fontSize: FONT_SIZE.p1 * 0.5,
|
|
71
|
+
},
|
|
62
72
|
};
|
|
63
73
|
};
|