@quintype/native-components 2.29.9 → 2.30.0--alt-story-layout-beta
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/package.json +1 -1
- package/src/components/AudioPlayer/index.js +1 -2
- package/src/components/BackNavigator/index.js +0 -4
- package/src/components/Button/index.js +2 -5
- package/src/components/Header/index.js +1 -3
- package/src/components/IconText/index.js +0 -3
- package/src/components/RadioButton/index.js +1 -4
- package/src/components/References/index.js +2 -2
- package/src/components/References/styles.js +2 -3
- package/src/components/Search/index.js +1 -3
- package/src/components/Story/index.js +3 -1
- package/src/components/StoryHeader/index.js +52 -20
- package/src/components/StoryHeader/styles.js +12 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { useProgress, usePlaybackState, State } from "react-native-track-player";
|
|
4
|
-
import { TouchableOpacity, ActivityIndicator, View,
|
|
4
|
+
import { TouchableOpacity, ActivityIndicator, View, useWindowDimensions } from "react-native";
|
|
5
5
|
import Icon from "react-native-vector-icons/AntDesign";
|
|
6
6
|
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
|
|
7
7
|
import { playerStyles } from "./styles";
|
|
@@ -135,7 +135,6 @@ ControlButton.propTypes = {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
PlayerBase.propTypes = {
|
|
138
|
-
style: ViewPropTypes.style,
|
|
139
138
|
onTogglePlayback: PropTypes.func.isRequired,
|
|
140
139
|
testID: PropTypes.string,
|
|
141
140
|
};
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
StyleSheet,
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
|
-
ViewPropTypes,
|
|
9
8
|
} from 'react-native';
|
|
10
9
|
import Icon from 'react-native-vector-icons/AntDesign';
|
|
11
10
|
import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
|
|
@@ -70,9 +69,6 @@ export const BackNavigator = (props) => {
|
|
|
70
69
|
|
|
71
70
|
BackNavigator.propTypes = {
|
|
72
71
|
title: PropTypes.string,
|
|
73
|
-
style: ViewPropTypes.style,
|
|
74
|
-
container: ViewPropTypes.style,
|
|
75
|
-
titleStyle: ViewPropTypes.style,
|
|
76
72
|
testID: PropTypes.string,
|
|
77
73
|
onPress: PropTypes.func.isRequired,
|
|
78
74
|
};
|
|
@@ -3,8 +3,7 @@ import React, { useContext } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
StyleSheet,
|
|
5
5
|
TouchableOpacity,
|
|
6
|
-
View
|
|
7
|
-
ViewPropTypes,
|
|
6
|
+
View
|
|
8
7
|
} from "react-native";
|
|
9
8
|
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
10
9
|
import { AppTheme } from "../../utils";
|
|
@@ -37,7 +36,5 @@ export const Button = (props) => {
|
|
|
37
36
|
Button.propTypes = {
|
|
38
37
|
icon: PropTypes.element,
|
|
39
38
|
text: PropTypes.string,
|
|
40
|
-
onPress: PropTypes.func
|
|
41
|
-
style: ViewPropTypes.style,
|
|
42
|
-
textStyle: ViewPropTypes.style,
|
|
39
|
+
onPress: PropTypes.func
|
|
43
40
|
};
|
|
@@ -3,8 +3,7 @@ import React, { useContext } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
StyleSheet,
|
|
5
5
|
TouchableOpacity,
|
|
6
|
-
View
|
|
7
|
-
ViewPropTypes,
|
|
6
|
+
View
|
|
8
7
|
} from "react-native";
|
|
9
8
|
|
|
10
9
|
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants";
|
|
@@ -46,7 +45,6 @@ Header.propTypes = {
|
|
|
46
45
|
rightComponent: PropTypes.element,
|
|
47
46
|
leftComponent: PropTypes.element,
|
|
48
47
|
logoComponent: PropTypes.element,
|
|
49
|
-
style: ViewPropTypes.style,
|
|
50
48
|
logoComponentStyle: PropTypes.object,
|
|
51
49
|
onPress: PropTypes.func,
|
|
52
50
|
noBorder: PropTypes.bool,
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
StyleSheet,
|
|
5
5
|
TouchableOpacity,
|
|
6
6
|
View,
|
|
7
|
-
ViewPropTypes,
|
|
8
7
|
} from "react-native";
|
|
9
8
|
import Icon from "react-native-vector-icons/FontAwesome";
|
|
10
9
|
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
@@ -80,8 +79,6 @@ IconText.propTypes = {
|
|
|
80
79
|
iconSize: PropTypes.number,
|
|
81
80
|
onPress: PropTypes.func,
|
|
82
81
|
disabled: PropTypes.bool,
|
|
83
|
-
iconStyle: ViewPropTypes.style,
|
|
84
|
-
labelStyle: ViewPropTypes.style,
|
|
85
82
|
};
|
|
86
83
|
|
|
87
84
|
export { IconText };
|
|
@@ -3,8 +3,7 @@ import React, { useContext } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
StyleSheet,
|
|
5
5
|
TouchableOpacity,
|
|
6
|
-
View
|
|
7
|
-
ViewPropTypes,
|
|
6
|
+
View
|
|
8
7
|
} from "react-native";
|
|
9
8
|
import { AppTheme } from "../../utils";
|
|
10
9
|
import { radioButtonStyles } from "./styles";
|
|
@@ -41,6 +40,4 @@ export const RadioButton = ({
|
|
|
41
40
|
RadioButton.propTypes = {
|
|
42
41
|
onPress: PropTypes.func.isRequired,
|
|
43
42
|
isChecked: PropTypes.bool,
|
|
44
|
-
circleStyle: ViewPropTypes.style,
|
|
45
|
-
checkedCircleStyle: ViewPropTypes.style,
|
|
46
43
|
};
|
|
@@ -5,7 +5,7 @@ import { Linking, View, TouchableOpacity } from 'react-native';
|
|
|
5
5
|
import { AppTheme } from '../../utils';
|
|
6
6
|
import { Text } from '../Text';
|
|
7
7
|
import { styles } from './styles';
|
|
8
|
-
import Icon from "react-native-vector-icons/
|
|
8
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
9
9
|
|
|
10
10
|
export const References = ({
|
|
11
11
|
card, referenceNameTestId, referenceDescTestID, referenceContainerTestID,
|
|
@@ -22,7 +22,7 @@ export const References = ({
|
|
|
22
22
|
<View style={referenceStyles.container} testID={referenceContainerTestID}>
|
|
23
23
|
<View>
|
|
24
24
|
<View style={referenceStyles.topSubContainer}>
|
|
25
|
-
<Icon name={'external-link
|
|
25
|
+
<Icon name={'external-link'} size={FONT_SIZE.h2} style={referenceStyles.iconStyle} testID="referenceStoryIcon" />
|
|
26
26
|
<Text style={referenceStyles.referenceText}>{'REFERENCE'}</Text>
|
|
27
27
|
</View>
|
|
28
28
|
<Text style={referenceStyles.name} testID={referenceNameTestId}>
|
|
@@ -16,7 +16,6 @@ export const styles = (COLORS, FONT_SIZE, FONT_FAMILY) => StyleSheet.create({
|
|
|
16
16
|
},
|
|
17
17
|
name: {
|
|
18
18
|
fontSize: FONT_SIZE.h1,
|
|
19
|
-
fontWeight: 'bold',
|
|
20
19
|
marginTop:15,
|
|
21
20
|
textDecorationLine:'underline',
|
|
22
21
|
lineHeight:24,
|
|
@@ -31,8 +30,8 @@ export const styles = (COLORS, FONT_SIZE, FONT_FAMILY) => StyleSheet.create({
|
|
|
31
30
|
},
|
|
32
31
|
referenceText: {
|
|
33
32
|
marginLeft:5,
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
fontSize: FONT_SIZE.h3,
|
|
34
|
+
color:COLORS.BRAND_1,
|
|
36
35
|
},
|
|
37
36
|
topSubContainer:{
|
|
38
37
|
display: 'flex',
|
|
@@ -2,7 +2,7 @@ import React, {
|
|
|
2
2
|
useEffect, useRef, useContext, useState,
|
|
3
3
|
} from 'react';
|
|
4
4
|
import {
|
|
5
|
-
View, TextInput, StyleSheet,
|
|
5
|
+
View, TextInput, StyleSheet, TouchableOpacity,
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
import { useNavigation } from '@react-navigation/native';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -78,8 +78,6 @@ Search.propTypes = {
|
|
|
78
78
|
addListener: PropTypes.func,
|
|
79
79
|
}),
|
|
80
80
|
icon: PropTypes.element,
|
|
81
|
-
style: ViewPropTypes.style,
|
|
82
|
-
inputStyle: ViewPropTypes.style,
|
|
83
81
|
onEnter: PropTypes.func,
|
|
84
82
|
testID: PropTypes.string,
|
|
85
83
|
};
|
|
@@ -151,7 +151,8 @@ export const Story = ({
|
|
|
151
151
|
setShowTTSPlayer,
|
|
152
152
|
gaTrigerredTTS,
|
|
153
153
|
commentData,
|
|
154
|
-
commentLoader
|
|
154
|
+
commentLoader,
|
|
155
|
+
storyLayout
|
|
155
156
|
}) => {
|
|
156
157
|
const { theme } = useContext(AppTheme);
|
|
157
158
|
const { COLORS, FONT_SIZE, locale, DARK_MODE,translate, enableComments } = theme;
|
|
@@ -374,6 +375,7 @@ export const Story = ({
|
|
|
374
375
|
story={story}
|
|
375
376
|
onAuthorPress={onAuthorPress}
|
|
376
377
|
onSectionPress={onSectionPress}
|
|
378
|
+
storyLayout={storyLayout}
|
|
377
379
|
/>
|
|
378
380
|
{ storyHasAccess === 'granted' && audioS3Key && (!showPlayer ?
|
|
379
381
|
(<TouchableOpacity onPress={async()=>{
|
|
@@ -65,7 +65,7 @@ const getHeroComponent = (props) => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export const StoryHeader = (props) => {
|
|
68
|
-
const { story, firstVideoElement } = props;
|
|
68
|
+
const { story, firstVideoElement, storyLayout } = props;
|
|
69
69
|
const sectionData = get(story, ['sections', 0], {});
|
|
70
70
|
const { theme } = useContext(AppTheme);
|
|
71
71
|
|
|
@@ -81,13 +81,14 @@ export const StoryHeader = (props) => {
|
|
|
81
81
|
const reviewTitle = story['metadata'] && story['metadata']['review-title'];
|
|
82
82
|
const reviewData = story['metadata'] && story['metadata']['review-rating'];
|
|
83
83
|
|
|
84
|
-
const showAttribution = () => {
|
|
84
|
+
const showAttribution = (storyLayout) => {
|
|
85
|
+
const captionStyle = storyLayout === 'headline-priority' ? styles.headlinePriority.captionStyle : styles.captionStyle;
|
|
85
86
|
if (!caption && !attribution) {
|
|
86
87
|
return null;
|
|
87
88
|
}
|
|
88
89
|
return (
|
|
89
90
|
<View style={styles.captionContainerStyle}>
|
|
90
|
-
{caption && !firstVideoElement && <CustomHtmlParser text={caption} textStyle={
|
|
91
|
+
{caption && !firstVideoElement && <CustomHtmlParser text={caption} textStyle={captionStyle} containerStyle={{marginTop:-6, marginBottom:-15}}/>}
|
|
91
92
|
{attribution && !firstVideoElement && <CustomHtmlParser text={attribution} textStyle={styles.attributionStyle} containerStyle={{marginTop:-6, marginBottom:-10}}/>}
|
|
92
93
|
</View>
|
|
93
94
|
);
|
|
@@ -102,23 +103,59 @@ export const StoryHeader = (props) => {
|
|
|
102
103
|
slug && props.onSectionPress(slug);
|
|
103
104
|
};
|
|
104
105
|
|
|
106
|
+
const getSectionName = (storyLayout = 'default') => {
|
|
107
|
+
const style = storyLayout === 'headline-priority' ? styles.headlinePriority.sectionText : styles.sectionText
|
|
108
|
+
return <TouchableOpacity onPress={navigateToSection}>
|
|
109
|
+
<Text
|
|
110
|
+
style={style}
|
|
111
|
+
testID={COMP_CONTENT_CONSTANTS.sectionName}
|
|
112
|
+
>
|
|
113
|
+
{sectionData['display-name'] || ''}
|
|
114
|
+
</Text>
|
|
115
|
+
</TouchableOpacity>
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const getAuthorRow = () => {
|
|
119
|
+
return <AuthorRow
|
|
120
|
+
authors={story.authors}
|
|
121
|
+
onPress={props.onAuthorPress}
|
|
122
|
+
cdn={props.cdn}
|
|
123
|
+
readtime={story['read-time']}
|
|
124
|
+
/>
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const getDateTime = () => {
|
|
128
|
+
return <Text
|
|
129
|
+
style={styles.dateText}
|
|
130
|
+
testID={COMP_CONTENT_CONSTANTS.publishedDate}
|
|
131
|
+
>
|
|
132
|
+
{getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
|
|
133
|
+
</Text>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (storyLayout === 'headline-priority') {
|
|
137
|
+
return (
|
|
138
|
+
<View testID={props.testID}>
|
|
139
|
+
{getSectionName(storyLayout)}
|
|
140
|
+
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory} />
|
|
141
|
+
{getHeroComponent(props)}
|
|
142
|
+
{showAttribution(storyLayout)}
|
|
143
|
+
<View style={styles.dateBlock}>
|
|
144
|
+
{getDateTime()}
|
|
145
|
+
</View>
|
|
146
|
+
{getAuthorRow()}
|
|
147
|
+
{reviewTitle && <RatingLayout reviewTitle={reviewTitle} ratingValue={reviewData?.value} ratingLabel={reviewData?.label} />}
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
105
152
|
return (
|
|
106
153
|
<View testID={props.testID}>
|
|
107
154
|
{getHeroComponent(props)}
|
|
108
|
-
|
|
109
155
|
{showAttribution()}
|
|
110
|
-
|
|
111
156
|
<View style={styles.dateBlock}>
|
|
112
|
-
|
|
113
|
-
<Text
|
|
114
|
-
style={styles.sectionText}
|
|
115
|
-
testID={COMP_CONTENT_CONSTANTS.sectionName}
|
|
116
|
-
>
|
|
117
|
-
{sectionData['display-name'] || ''}
|
|
118
|
-
</Text>
|
|
119
|
-
</TouchableOpacity>
|
|
157
|
+
{getSectionName()}
|
|
120
158
|
<View style={styles.divider} />
|
|
121
|
-
|
|
122
159
|
{/* TODO: check why published at is undefined for some stories */}
|
|
123
160
|
<Text
|
|
124
161
|
style={styles.dateText}
|
|
@@ -128,12 +165,7 @@ export const StoryHeader = (props) => {
|
|
|
128
165
|
</Text>
|
|
129
166
|
</View>
|
|
130
167
|
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory}/>
|
|
131
|
-
|
|
132
|
-
authors={story.authors}
|
|
133
|
-
onPress={props.onAuthorPress}
|
|
134
|
-
cdn={props.cdn}
|
|
135
|
-
readtime={story['read-time']}
|
|
136
|
-
/>
|
|
168
|
+
{getAuthorRow()}
|
|
137
169
|
{reviewTitle && <RatingLayout reviewTitle={reviewTitle} ratingValue={reviewData?.value} ratingLabel={reviewData?.label}/>}
|
|
138
170
|
</View>
|
|
139
171
|
);
|
|
@@ -49,4 +49,16 @@ export const storyHeaderStyles = (COLORS, FONT_FAMILY) => StyleSheet.create({
|
|
|
49
49
|
width: 1.3,
|
|
50
50
|
backgroundColor: COLORS.BRAND_6,
|
|
51
51
|
},
|
|
52
|
+
headlinePriority: {
|
|
53
|
+
sectionText: {
|
|
54
|
+
color: COLORS.BRAND_1,
|
|
55
|
+
marginLeft: 10,
|
|
56
|
+
marginTop: 10,
|
|
57
|
+
},
|
|
58
|
+
captionStyle: {
|
|
59
|
+
color: COLORS.BRAND_BLACK,
|
|
60
|
+
fontFamily: FONT_FAMILY.secondary,
|
|
61
|
+
fontWeight: "bold",
|
|
62
|
+
},
|
|
63
|
+
}
|
|
52
64
|
});
|