@quintype/native-components 2.19.3 → 2.19.5
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 +7 -0
- package/package.json +5 -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 +16 -12
- 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 +17 -13
- package/src/components/StoryHeader/index.js +4 -6
- package/src/components/StoryText/index.js +3 -1
- package/src/components/Table/styles.js +4 -0
- package/src/components/TextQandA/styles.js +3 -4
- package/src/constants/component-constants/general-constants/constants.js +15 -14
- package/src/constants/renderHTML.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.5](https://github.com/quintype/native-components/compare/v2.19.3...v2.19.5) (2021-12-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **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))
|
|
11
|
+
|
|
5
12
|
### [2.19.3](https://github.com/quintype/native-components/compare/v2.18.4...v2.19.3) (2021-10-28)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.5",
|
|
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,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,19 +1,19 @@
|
|
|
1
|
-
import { throttle } from 'lodash';
|
|
1
|
+
import { get, throttle } from 'lodash';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { useContext, memo } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
I18nManager, StyleSheet, TouchableOpacity, View,
|
|
6
|
-
} from 'react-native';
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
7
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
|
+
|
|
16
|
+
|
|
17
17
|
|
|
18
18
|
const PrimaryStoryCardNewBase = (props) => {
|
|
19
19
|
const { story = {} } = props;
|
|
@@ -22,6 +22,8 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
22
22
|
COLORS, FONT_SIZE, locale, DARK_MODE,
|
|
23
23
|
} = theme || {};
|
|
24
24
|
|
|
25
|
+
const translate = get(theme, ["translate"], (word) => word);
|
|
26
|
+
|
|
25
27
|
const styles = storyStyles(COLORS, FONT_SIZE, DARK_MODE);
|
|
26
28
|
const containerStyle = StyleSheet.flatten([
|
|
27
29
|
styles.container,
|
|
@@ -36,8 +38,10 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
36
38
|
props.timestampStyle,
|
|
37
39
|
]);
|
|
38
40
|
|
|
39
|
-
const DATE_FORMAT =
|
|
40
|
-
const readTime = story[
|
|
41
|
+
const DATE_FORMAT = "d MMM, yyyy";
|
|
42
|
+
const readTime = story["read-time"]
|
|
43
|
+
? `${story["read-time"]} ${translate("min read")}`
|
|
44
|
+
: "";
|
|
41
45
|
|
|
42
46
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
43
47
|
|
|
@@ -99,7 +103,7 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
99
103
|
<Text style={timestampStyle}>{`${readTime} · `}</Text>
|
|
100
104
|
) : null}
|
|
101
105
|
<Text style={timestampStyle} testID="primaryStoryCardDate">
|
|
102
|
-
{getTimeForStoryCards(story[
|
|
106
|
+
{getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
|
|
103
107
|
</Text>
|
|
104
108
|
</View>
|
|
105
109
|
</View>
|
|
@@ -121,7 +125,7 @@ PrimaryStoryCardNewBase.propTypes = {
|
|
|
121
125
|
};
|
|
122
126
|
|
|
123
127
|
PrimaryStoryCardNewBase.defaultProps = {
|
|
124
|
-
cdn:
|
|
128
|
+
cdn: "",
|
|
125
129
|
horizontalPadding: 12,
|
|
126
130
|
};
|
|
127
131
|
|
|
@@ -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,
|
|
@@ -15,16 +15,18 @@ import {
|
|
|
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
22
|
|
|
23
23
|
const SecondaryStoryCardNewBase = (props) => {
|
|
24
24
|
const { story = {} } = props;
|
|
25
25
|
const { theme } = useContext(AppTheme);
|
|
26
26
|
const { locale, DARK_MODE, COLORS } = theme;
|
|
27
27
|
|
|
28
|
+
const translate = get(theme, ["translate"], (word) => word);
|
|
29
|
+
|
|
28
30
|
const styles = storyStyles(theme, DARK_MODE);
|
|
29
31
|
const containerStyle = StyleSheet.flatten([
|
|
30
32
|
styles.container,
|
|
@@ -39,8 +41,10 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
39
41
|
props.timestampStyle,
|
|
40
42
|
]);
|
|
41
43
|
|
|
42
|
-
const DATE_FORMAT =
|
|
43
|
-
const readTime = story[
|
|
44
|
+
const DATE_FORMAT = "d MMM, yyyy";
|
|
45
|
+
const readTime = story["read-time"]
|
|
46
|
+
? `${story["read-time"]} ${translate("min read")}`
|
|
47
|
+
: "";
|
|
44
48
|
|
|
45
49
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
46
50
|
|
|
@@ -81,8 +85,8 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
81
85
|
>
|
|
82
86
|
<ResponsiveImage
|
|
83
87
|
metaData={getImageMetadata(story)}
|
|
84
|
-
slug={getImageSlug(story) ||
|
|
85
|
-
cdn={props.cdn ||
|
|
88
|
+
slug={getImageSlug(story) || ""}
|
|
89
|
+
cdn={props.cdn || ""}
|
|
86
90
|
imageWidth={props.imageWidth}
|
|
87
91
|
>
|
|
88
92
|
<View style={styles.storyTypeContainer}>{showStoryType()}</View>
|
|
@@ -102,7 +106,7 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
102
106
|
<Text style={timestampStyle}>{`${readTime} · `}</Text>
|
|
103
107
|
) : null}
|
|
104
108
|
<Text style={timestampStyle} testID="secondaryStoryCardDate">
|
|
105
|
-
{getTimeForStoryCards(story[
|
|
109
|
+
{getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
|
|
106
110
|
</Text>
|
|
107
111
|
</View>
|
|
108
112
|
</View>
|
|
@@ -123,7 +127,7 @@ SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
|
|
|
123
127
|
};
|
|
124
128
|
|
|
125
129
|
SecondaryStoryCardNewBase.defaultProps = {
|
|
126
|
-
cdn:
|
|
130
|
+
cdn: "",
|
|
127
131
|
horizontalPadding: 12,
|
|
128
132
|
};
|
|
129
133
|
|
|
@@ -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'];
|
|
@@ -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 (
|
|
@@ -15,6 +15,7 @@ export const tableStyles = ({ COLORS }) => StyleSheet.create({
|
|
|
15
15
|
justifyContent: 'center',
|
|
16
16
|
borderWidth: 0.5,
|
|
17
17
|
borderColor: COLORS.BRAND_4,
|
|
18
|
+
color: COLORS.BRAND_4,
|
|
18
19
|
},
|
|
19
20
|
tableBody: {
|
|
20
21
|
flexDirection: 'column',
|
|
@@ -22,4 +23,7 @@ export const tableStyles = ({ COLORS }) => StyleSheet.create({
|
|
|
22
23
|
tableRow: {
|
|
23
24
|
flexDirection: 'row',
|
|
24
25
|
},
|
|
26
|
+
tableContect: {
|
|
27
|
+
color: COLORS.BRAND_BLACK,
|
|
28
|
+
},
|
|
25
29
|
});
|
|
@@ -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
|
});
|
|
@@ -1,16 +1,17 @@
|
|
|
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:
|
|
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",
|
|
16
17
|
};
|
|
@@ -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
|
};
|