@quintype/native-components 2.30.0 → 2.30.1--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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.30.0",
3
+ "version": "2.30.1--alt-story-layout-beta",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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
 
@@ -80,14 +80,16 @@ export const StoryHeader = (props) => {
80
80
  const isPremiumStory = story['access'] === 'subscription';
81
81
  const reviewTitle = story['metadata'] && story['metadata']['review-title'];
82
82
  const reviewData = story['metadata'] && story['metadata']['review-rating'];
83
+ const isHeadLinePriorityLayout = storyLayout === 'headline-priority';
83
84
 
84
- const showAttribution = () => {
85
+ const showAttribution = (storyLayout) => {
86
+ const captionStyle = isHeadLinePriorityLayout ? styles.headlinePriority.captionStyle : styles.captionStyle;
85
87
  if (!caption && !attribution) {
86
88
  return null;
87
89
  }
88
90
  return (
89
91
  <View style={styles.captionContainerStyle}>
90
- {caption && !firstVideoElement && <CustomHtmlParser text={caption} textStyle={styles.captionStyle} containerStyle={{marginTop:-6, marginBottom:-15}}/>}
92
+ {caption && !firstVideoElement && <CustomHtmlParser text={caption} textStyle={captionStyle} containerStyle={{marginTop:-6, marginBottom:-15}}/>}
91
93
  {attribution && !firstVideoElement && <CustomHtmlParser text={attribution} textStyle={styles.attributionStyle} containerStyle={{marginTop:-6, marginBottom:-10}}/>}
92
94
  </View>
93
95
  );
@@ -102,23 +104,59 @@ export const StoryHeader = (props) => {
102
104
  slug && props.onSectionPress(slug);
103
105
  };
104
106
 
107
+ const getSectionName = (storyLayout = 'default') => {
108
+ const style = isHeadLinePriorityLayout ? styles.headlinePriority.sectionText : styles.sectionText
109
+ return <TouchableOpacity onPress={navigateToSection}>
110
+ <Text
111
+ style={style}
112
+ testID={COMP_CONTENT_CONSTANTS.sectionName}
113
+ >
114
+ {sectionData['display-name'] || ''}
115
+ </Text>
116
+ </TouchableOpacity>
117
+ }
118
+
119
+ const getAuthorRow = () => {
120
+ return <AuthorRow
121
+ authors={story.authors}
122
+ onPress={props.onAuthorPress}
123
+ cdn={props.cdn}
124
+ readtime={story['read-time']}
125
+ />
126
+ }
127
+
128
+ const getDateTime = () => {
129
+ return <Text
130
+ style={styles.dateText}
131
+ testID={COMP_CONTENT_CONSTANTS.publishedDate}
132
+ >
133
+ {getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
134
+ </Text>
135
+ }
136
+
137
+ if (isHeadLinePriorityLayout) {
138
+ return (
139
+ <View testID={props.testID}>
140
+ {getSectionName(storyLayout)}
141
+ <StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory} />
142
+ {getHeroComponent(props)}
143
+ {showAttribution(storyLayout)}
144
+ <View style={styles.dateBlock}>
145
+ {getDateTime()}
146
+ </View>
147
+ {getAuthorRow()}
148
+ {reviewTitle && <RatingLayout reviewTitle={reviewTitle} ratingValue={reviewData?.value} ratingLabel={reviewData?.label} />}
149
+ </View>
150
+ );
151
+ }
152
+
105
153
  return (
106
154
  <View testID={props.testID}>
107
155
  {getHeroComponent(props)}
108
-
109
156
  {showAttribution()}
110
-
111
157
  <View style={styles.dateBlock}>
112
- <TouchableOpacity onPress={navigateToSection}>
113
- <Text
114
- style={styles.sectionText}
115
- testID={COMP_CONTENT_CONSTANTS.sectionName}
116
- >
117
- {sectionData['display-name'] || ''}
118
- </Text>
119
- </TouchableOpacity>
158
+ {getSectionName()}
120
159
  <View style={styles.divider} />
121
-
122
160
  {/* TODO: check why published at is undefined for some stories */}
123
161
  <Text
124
162
  style={styles.dateText}
@@ -128,12 +166,7 @@ export const StoryHeader = (props) => {
128
166
  </Text>
129
167
  </View>
130
168
  <StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory}/>
131
- <AuthorRow
132
- authors={story.authors}
133
- onPress={props.onAuthorPress}
134
- cdn={props.cdn}
135
- readtime={story['read-time']}
136
- />
169
+ {getAuthorRow()}
137
170
  {reviewTitle && <RatingLayout reviewTitle={reviewTitle} ratingValue={reviewData?.value} ratingLabel={reviewData?.label}/>}
138
171
  </View>
139
172
  );
@@ -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
  });
@@ -7,12 +7,13 @@ import { AppTheme } from '../../utils';
7
7
  import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
8
8
  import PremiumIcons from '../../Icons/PremiumIcons/index';
9
9
 
10
- export const StoryTitle = ({ title, subTitle, isPremiumStory }) => {
10
+ export const StoryTitle = ({ title, subTitle, isPremiumStory, isHeadLinePriorityLayout }) => {
11
11
  const { theme } = useContext(AppTheme);
12
12
  const styles = storyTitleStyles(theme);
13
13
  const {
14
14
  premiumIcon, COLORS, FONT_SIZE
15
15
  } = theme;
16
+ const subTitleStyle = isHeadLinePriorityLayout? styles.headLinePriority.subTitleStyle : styles.subTitleStyle;
16
17
  return (
17
18
  <View style={styles.container}>
18
19
  <Text
@@ -27,7 +28,7 @@ export const StoryTitle = ({ title, subTitle, isPremiumStory }) => {
27
28
 
28
29
  {subTitle && (
29
30
  <Text
30
- style={styles.subTitleStyle}
31
+ style={subTitleStyle}
31
32
  testID={COMP_CONTENT_CONSTANTS.storySubTitle}
32
33
  >
33
34
  {subTitle || ''}
@@ -25,4 +25,13 @@ export const storyTitleStyles = ({
25
25
  marginRight: -5,
26
26
  borderWidth: 1,
27
27
  },
28
+ headLinePriority: {
29
+ subTitleStyle: {
30
+ fontSize: FONT_SIZE.h3,
31
+ lineHeight: FONT_SIZE.h3 * lineHeightMultiplier,
32
+ color: COLORS.BRAND_6,
33
+ marginTop: 10,
34
+ marginBottom: 12
35
+ }
36
+ }
28
37
  });