@quintype/native-components 2.22.7 → 2.28.1

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.
Files changed (46) hide show
  1. package/package.json +1 -1
  2. package/src/components/AlsoRead/index.js +4 -4
  3. package/src/components/AuthorRow/index.js +3 -3
  4. package/src/components/BackNavigator/index.js +6 -6
  5. package/src/components/Button/index.js +1 -1
  6. package/src/components/CollectionCard/index.js +20 -10
  7. package/src/components/CollectionTitle/index.js +20 -38
  8. package/src/components/CollectionTitle/styles.js +11 -13
  9. package/src/components/CustomSwitch/index.js +4 -4
  10. package/src/components/DailyMotionPlayer/index.js +2 -2
  11. package/src/components/Header/index.js +2 -2
  12. package/src/components/Html/index.js +4 -4
  13. package/src/components/IconText/index.js +4 -4
  14. package/src/components/JSEmbedElement/index.js +3 -3
  15. package/src/components/LightBoxImage/index.js +2 -2
  16. package/src/components/PDFReader/index.js +7 -8
  17. package/src/components/PrimaryStoryCard/index.js +47 -92
  18. package/src/components/PrimaryStoryCard/styles.js +30 -49
  19. package/src/components/RadioButton/index.js +3 -3
  20. package/src/components/Rating/index.js +1 -1
  21. package/src/components/RelatedStoriesCard/index.js +2 -12
  22. package/src/components/SecondaryStoryCard/index.js +59 -108
  23. package/src/components/SecondaryStoryCard/styles.js +35 -55
  24. package/src/components/Story/index.js +12 -13
  25. package/src/components/StoryHeader/index.js +8 -8
  26. package/src/components/StoryTemplateIcon/index.js +58 -0
  27. package/src/components/StoryTemplateIcon/styles.js +23 -0
  28. package/src/components/StoryText/index.js +5 -2
  29. package/src/components/TextA/index.js +4 -4
  30. package/src/components/TextBigFact/index.js +4 -4
  31. package/src/components/TextBlockQuote/index.js +5 -5
  32. package/src/components/TextBlurb/index.js +3 -3
  33. package/src/components/TextQandA/index.js +2 -3
  34. package/src/components/index.js +1 -4
  35. package/src/utils/story-types.js +1 -0
  36. package/src/components/CollectionCardNew/index.js +0 -84
  37. package/src/components/CollectionTitle/CollectionTitle.test.js +0 -12
  38. package/src/components/CollectionTitle/__snapshots__/CollectionTitle.test.js.snap +0 -3
  39. package/src/components/CollectionTitleNew/index.js +0 -44
  40. package/src/components/CollectionTitleNew/styles.js +0 -20
  41. package/src/components/PrimaryStoryCard/PrimaryStoryCard.test.js +0 -43
  42. package/src/components/PrimaryStoryCardNew/index.js +0 -134
  43. package/src/components/PrimaryStoryCardNew/styles.js +0 -70
  44. package/src/components/SecondaryStoryCard/SecondaryStoryCard.test.js +0 -51
  45. package/src/components/SecondaryStoryCardNew/index.js +0 -140
  46. package/src/components/SecondaryStoryCardNew/styles.js +0 -82
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.22.7",
3
+ "version": "2.28.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,10 +1,10 @@
1
- import React, { useContext } from 'react';
2
1
  import get from 'lodash/get';
3
- import { View, TouchableOpacity } from 'react-native';
4
- import { ResponsiveImage, Text } from '../index';
5
- import { alsoReadStyles } from './styles';
2
+ import React, { useContext } from 'react';
3
+ import { TouchableOpacity, View } from 'react-native';
6
4
  import { FallbackIcon } from '../../Icons/FallBackIcon';
7
5
  import { AppTheme } from '../../utils';
6
+ import { ResponsiveImage, Text } from '../index';
7
+ import { alsoReadStyles } from './styles';
8
8
 
9
9
  export const AlsoRead = (props) => {
10
10
  const {
@@ -2,12 +2,12 @@ import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import { View } from 'react-native';
4
4
  import Icon from 'react-native-vector-icons/FontAwesome';
5
- import { ResponsiveImage, Text } from '../index';
6
5
  import { ActionText } from '../ActionText/ActionText';
6
+ import { ResponsiveImage, Text } from '../index';
7
7
 
8
- import { authorRowStyleSheet } from './styles';
9
- import { AppTheme } from '../../utils';
10
8
  import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
9
+ import { AppTheme } from '../../utils';
10
+ import { authorRowStyleSheet } from './styles';
11
11
 
12
12
  export const AuthorRow = ({
13
13
  authors,
@@ -1,18 +1,18 @@
1
+ import PropTypes from 'prop-types';
1
2
  import React, { useContext } from 'react';
2
3
  import {
3
- View,
4
+ I18nManager,
4
5
  StyleSheet,
5
- ViewPropTypes,
6
6
  TouchableOpacity,
7
- I18nManager,
7
+ View,
8
+ ViewPropTypes,
8
9
  } from 'react-native';
9
10
  import Icon from 'react-native-vector-icons/AntDesign';
10
- import PropTypes from 'prop-types';
11
- import { AppTheme } from '../../utils/context';
12
11
  import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
12
+ import { AppTheme } from '../../utils/context';
13
13
 
14
- import { backNavigatorStyles } from './styles';
15
14
  import { Text } from '../Text';
15
+ import { backNavigatorStyles } from './styles';
16
16
 
17
17
  export const BackNavigator = (props) => {
18
18
  const { theme } = useContext(AppTheme);
@@ -6,10 +6,10 @@ import {
6
6
  View,
7
7
  ViewPropTypes,
8
8
  } from "react-native";
9
+ import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
9
10
  import { AppTheme } from "../../utils";
10
11
  import { Text } from "../Text";
11
12
  import { styles } from "./styles";
12
- import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
13
13
 
14
14
  export const Button = (props) => {
15
15
  const { icon, text, onPress } = props;
@@ -1,20 +1,22 @@
1
1
  import get from 'lodash/get';
2
2
  import isEmpty from 'lodash/isEmpty';
3
3
  import PropTypes from 'prop-types';
4
- import React from 'react';
4
+ import React, { memo } from 'react';
5
5
  import { getScreenPercentageWidth } from '../../utils/index';
6
6
  import {
7
7
  CollectionTitle,
8
8
  PrimaryStoryCard,
9
9
  SecondaryStoryCard,
10
+ ShareButton,
10
11
  } from '../index';
11
12
 
12
- export const CollectionCard = ({
13
+ const CollectionCardBase = ({
13
14
  cdn,
14
15
  collectionName,
15
16
  stories,
16
17
  onCollectionPress,
17
18
  onStoryPress,
19
+ collectionTestID,
18
20
  offset,
19
21
  horizontalPadding,
20
22
  initialOffset, /* Number of items to load on first load */
@@ -22,10 +24,10 @@ export const CollectionCard = ({
22
24
  }) => {
23
25
  const sliceLimit = offset || initialOffset || 5;
24
26
  const primaryStory = !isEmpty(stories) && get(stories, [0, 'story'], stories[0]);
27
+
25
28
  return (
26
29
  <>
27
- {!hideCollectionTitle
28
- && (
30
+ {!hideCollectionTitle && (
29
31
  <CollectionTitle
30
32
  title={collectionName}
31
33
  onPress={onCollectionPress}
@@ -33,11 +35,13 @@ export const CollectionCard = ({
33
35
  />
34
36
  )}
35
37
  <PrimaryStoryCard
38
+ collectionTestID={collectionTestID}
36
39
  onPress={() => {
37
40
  !isEmpty(stories) && onStoryPress(primaryStory);
38
41
  }}
39
42
  cdn={cdn}
40
43
  story={!isEmpty(stories) ? primaryStory : {}}
44
+ iconComponent={<ShareButton story={primaryStory} inListingStoryCard />}
41
45
  imageWidth={getScreenPercentageWidth(100) - 2 * horizontalPadding}
42
46
  horizontalPadding={horizontalPadding}
43
47
  />
@@ -45,11 +49,13 @@ export const CollectionCard = ({
45
49
  const secondaryStory = get(currentStory, ['story'], currentStory);
46
50
  return (
47
51
  <SecondaryStoryCard
52
+ collectionTestID={collectionTestID}
48
53
  onPress={() => onStoryPress(secondaryStory)}
49
- key={`${secondaryStory?.id}`}
54
+ key={secondaryStory?.id}
50
55
  cdn={cdn}
51
56
  story={secondaryStory}
52
- imageWidth={getScreenPercentageWidth(40)}
57
+ iconComponent={<ShareButton story={secondaryStory} inListingStoryCard />}
58
+ imageWidth={getScreenPercentageWidth(28)}
53
59
  horizontalPadding={horizontalPadding}
54
60
  />
55
61
  );
@@ -57,18 +63,22 @@ export const CollectionCard = ({
57
63
  </>
58
64
  );
59
65
  };
60
- CollectionCard.propTypes = {
66
+
67
+ CollectionCardBase.propTypes = {
68
+ offset: PropTypes.number,
61
69
  initialOffset: PropTypes.number,
62
70
  cdn: PropTypes.string.isRequired,
63
- collectionName: PropTypes.string.isRequired,
71
+ collectionName: PropTypes.string,
64
72
  stories: PropTypes.array.isRequired,
65
73
  onCollectionPress: PropTypes.func,
66
74
  onStoryPress: PropTypes.func,
67
- offset: PropTypes.number,
75
+ collectionTestID: PropTypes.string,
68
76
  horizontalPadding: PropTypes.number,
69
77
  hideCollectionTitle: PropTypes.bool,
70
78
  };
71
79
 
72
- CollectionCard.defaultProps = {
80
+ CollectionCardBase.defaultProps = {
73
81
  horizontalPadding: 12,
74
82
  };
83
+
84
+ export const CollectionCard = memo(CollectionCardBase);
@@ -1,61 +1,43 @@
1
1
  import PropTypes from 'prop-types';
2
- import React, { useContext } from 'react';
2
+ import React, { memo, useContext } from 'react';
3
3
  import {
4
- TextStyle,
5
- TouchableOpacity,
6
- TouchableOpacityProps,
7
- View,
8
- ViewStyle,
9
4
  StyleSheet,
5
+ TouchableOpacity,
6
+ TouchableOpacityProps
10
7
  } from 'react-native';
11
-
12
- import { Text } from '../index';
13
-
14
- import { collectionStyles } from './styles';
15
8
  import { AppTheme } from '../../utils';
16
- import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
9
+ import { Text } from '../index';
10
+ import { collectionTitleStyles } from './styles';
17
11
 
18
- export const CollectionTitle = (props) => {
12
+ const CollectionTitleBase = (props) => {
19
13
  const { theme } = useContext(AppTheme);
20
- const styles = collectionStyles(theme);
14
+ const styles = collectionTitleStyles(theme);
21
15
  const containerStyle = StyleSheet.flatten([
22
- styles.titleContainer,
16
+ styles.container,
23
17
  { paddingHorizontal: props.horizontalPadding },
24
18
  ]);
25
- const titleStyle = StyleSheet.flatten([styles.titleStyle, props.titleStyle]);
26
- const indicatorStyle = StyleSheet.flatten([
27
- styles.indicatorStyle,
28
- props.indicatorStyle,
29
- ]);
19
+ const titleStyle = StyleSheet.flatten([styles.title, props.titleStyle]);
30
20
 
31
21
  if (!props.title) {
32
22
  return null;
33
23
  }
34
24
 
35
25
  return (
36
- <TouchableOpacity
37
- style={containerStyle}
38
- onPress={props.onPress}
39
- testID={COMP_GENERAL_CONSTANTS.collectionTitleTouch}
40
- >
41
- <Text
42
- style={titleStyle}
43
- testID={COMP_GENERAL_CONSTANTS.collectionTitleText}
44
- >
45
- {props.title}
46
- </Text>
47
- <View style={indicatorStyle} />
26
+ <TouchableOpacity style={containerStyle} onPress={props.onPress}>
27
+ <Text style={titleStyle}>{props.title}</Text>
48
28
  </TouchableOpacity>
49
29
  );
50
30
  };
51
31
 
52
- CollectionTitle.propTypes = TouchableOpacityProps && {
53
- title: PropTypes.string,
54
- titleStyle: TextStyle,
55
- indicatorStyle: ViewStyle,
56
- horizontalPadding: PropTypes.number,
57
- };
32
+ CollectionTitleBase.propTypes = TouchableOpacityProps
33
+ && {
34
+ title: PropTypes.string,
35
+ titleStyle: TextStyle,
36
+ horizontalPadding: PropTypes.number,
37
+ };
58
38
 
59
- CollectionTitle.defaultProps = {
39
+ CollectionTitleBase.defaultProps = {
60
40
  horizontalPadding: 12,
61
41
  };
42
+
43
+ export const CollectionTitle = memo(CollectionTitleBase);
@@ -1,22 +1,20 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
- export const collectionStyles = (appThemeContext) => {
4
- const { COLORS, FONT_SIZE } = appThemeContext;
3
+ export const collectionTitleStyles = (appThemeContext) => {
4
+ const { COLORS, FONT_SIZE, FONT_FAMILY } = appThemeContext;
5
+
5
6
  return StyleSheet.create({
6
- titleContainer: {
7
- backgroundColor: COLORS.BRAND_WHITE,
8
- paddingVertical: 12,
7
+ container: {
9
8
  justifyContent: 'center',
9
+ backgroundColor: COLORS.BRAND_WHITE,
10
+ paddingHorizontal: 12,
11
+ paddingVertical: 8,
12
+ marginTop: 8,
10
13
  },
11
- titleStyle: {
12
- fontSize: FONT_SIZE.h1,
14
+ title: {
15
+ fontSize: FONT_SIZE.h3,
16
+ fontFamily: FONT_FAMILY.secondaryBold,
13
17
  color: COLORS.BRAND_5,
14
18
  },
15
- indicatorStyle: {
16
- marginTop: 8,
17
- width: 30,
18
- height: 3,
19
- backgroundColor: COLORS.BRAND_1,
20
- },
21
19
  });
22
20
  };
@@ -1,11 +1,11 @@
1
- import React, { useContext, useState } from "react";
2
- import { Switch, View } from "react-native";
3
1
  import PropTypes from "prop-types";
2
+ import React, { useContext } from "react";
3
+ import { Switch, View } from "react-native";
4
4
  import Icon from "react-native-vector-icons/FontAwesome";
5
- import { Text } from "../Text";
5
+ import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
6
6
  import { AppTheme } from "../../utils";
7
+ import { Text } from "../Text";
7
8
  import { customSwitchStyles } from "./styles";
8
- import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
9
9
 
10
10
  export const CustomSwitch = ({
11
11
  label = "",
@@ -1,6 +1,6 @@
1
- import React, { useRef } from 'react';
2
- import PropTypes from 'prop-types';
3
1
  import get from 'lodash/get';
2
+ import PropTypes from 'prop-types';
3
+ import React, { useRef } from 'react';
4
4
  import { WebView } from 'react-native-webview';
5
5
  import { dailyMotionStyles } from './styles';
6
6
 
@@ -7,9 +7,9 @@ import {
7
7
  ViewPropTypes,
8
8
  } from "react-native";
9
9
 
10
- import { headerStyles } from "./styles";
11
- import { AppTheme } from "../../utils";
12
10
  import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants";
11
+ import { AppTheme } from "../../utils";
12
+ import { headerStyles } from "./styles";
13
13
 
14
14
  export const Header = (props) => {
15
15
  const { theme } = useContext(AppTheme);
@@ -1,8 +1,8 @@
1
- import { TouchableOpacity, View, I18nManager, StyleSheet, Linking } from "react-native";
2
- import HTML from "react-native-render-html";
3
- import React from "react";
4
- import isHTML from "is-html";
5
1
  import { Text } from "@quintype/native-components/src/components/Text";
2
+ import isHTML from "is-html";
3
+ import React from "react";
4
+ import { I18nManager, Linking, StyleSheet } from "react-native";
5
+ import HTML from "react-native-render-html";
6
6
 
7
7
  const CustomHtmlParser = ({ text, textStyle={}, containerStyle={} }) => {
8
8
  const textStyles = StyleSheet.flatten([
@@ -1,15 +1,15 @@
1
+ import PropTypes from "prop-types";
1
2
  import React from "react";
2
3
  import {
3
- View,
4
- TouchableOpacity,
5
4
  StyleSheet,
5
+ TouchableOpacity,
6
+ View,
6
7
  ViewPropTypes,
7
8
  } from "react-native";
8
9
  import Icon from "react-native-vector-icons/FontAwesome";
9
- import PropTypes from "prop-types";
10
+ import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
10
11
  import { Text } from "../Text";
11
12
  import { iconTextStyles } from "./iconText_styles";
12
- import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
13
13
 
14
14
  const IconText = ({
15
15
  onPress,
@@ -1,9 +1,9 @@
1
- import { WebView } from 'react-native-webview';
2
- import React, { useState, useRef, useEffect } from 'react';
3
1
  import { decode as atob } from 'base-64';
2
+ import get from 'lodash/get';
4
3
  import PropTypes from 'prop-types';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
5
  import { Dimensions, View } from 'react-native';
6
- import get from 'lodash/get';
6
+ import { WebView } from 'react-native-webview';
7
7
  import { STORY_ELEMENT_SUBTYPES } from '../../constants/cardConstants';
8
8
 
9
9
  const escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
@@ -1,9 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useState } from 'react';
3
3
  import { TouchableOpacity } from 'react-native';
4
- import { ResponsiveImage } from '../ResponsiveImage';
5
- import { LightBox } from '../LightBox';
6
4
  import { getImageHeight } from '../../utils';
5
+ import { LightBox } from '../LightBox';
6
+ import { ResponsiveImage } from '../ResponsiveImage';
7
7
 
8
8
  export const LightBoxImage = ({
9
9
  data, hero, currentLayout, additionalStyles, elementType, onClickHandler = () => {}, index,
@@ -1,21 +1,20 @@
1
1
  import PropTypes from 'prop-types';
2
- import React, { useState, useContext } from 'react';
2
+ import React, { useContext, useState } from 'react';
3
3
  import {
4
- View,
5
4
  Modal,
6
- TouchableOpacity,
5
+ Platform,
7
6
  SafeAreaView,
8
7
  StyleSheet,
9
- Platform
8
+ TouchableOpacity,
9
+ View
10
10
  } from 'react-native';
11
+ import Pdf from 'react-native-pdf';
11
12
  import IonIcon from 'react-native-vector-icons/Ionicons';
12
13
  import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
13
- import Pdf from 'react-native-pdf';
14
14
 
15
- import { Text } from '../index';
16
- import { pdfStyles } from './styles';
17
- import { ShareButton } from '../index';
18
15
  import { AppTheme } from '../../utils';
16
+ import { ShareButton, Text } from '../index';
17
+ import { pdfStyles } from './styles';
19
18
 
20
19
  export const PDFReader = ({ card, story }) => {
21
20
  const [modalVisible, setModalVisible] = useState(false);
@@ -1,41 +1,31 @@
1
- import { throttle } from 'lodash';
2
- import get from 'lodash/get';
1
+ import { get, throttle } from 'lodash';
3
2
  import PropTypes from 'prop-types';
4
- import React, { useContext } from 'react';
3
+ import React, { memo, useContext } from 'react';
5
4
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
6
- import Icon from 'react-native-vector-icons/FontAwesome';
5
+ import PremiumIcons from '../../Icons/PremiumIcons/index';
6
+ import {
7
+ COMP_GENERAL_CONSTANTS,
8
+ } from '../../constants/component-constants';
7
9
  import {
8
10
  AppTheme,
9
11
  getImageMetadata,
10
12
  getImageSlug,
11
- getTimeForStoryCards,
12
13
  } from '../../utils';
13
14
  import { getStoryHeadline } from '../../utils/story';
14
- import { ResponsiveImage, Text } from '../index';
15
+ import { ResponsiveImage, StoryCardDetailsRow, Text, StoryTemplateIcon } from '../index';
15
16
  import { storyStyles } from './styles';
16
- import {
17
- COMP_GENERAL_CONSTANTS,
18
- COMP_CONTENT_CONSTANTS,
19
- } from '../../constants/component-constants';
20
17
 
21
- export const PrimaryStoryCard = (props) => {
18
+ const PrimaryStoryCardBase = (props) => {
22
19
  const { story = {} } = props;
23
20
  const { theme } = useContext(AppTheme);
24
-
25
- const translate = get(theme, ['translate'], (word) => word);
26
-
27
21
  const {
28
22
  COLORS,
29
23
  FONT_SIZE,
30
- locale,
31
- reverseTimeAdverbPosition,
32
- enableReadTimeOnStoryCards,
33
- DATE_TIME_FORMAT,
24
+ premiumIcon,
25
+ storyCardOptions = {},
34
26
  } = theme || {};
35
27
 
36
- const DATE_FORMAT = DATE_TIME_FORMAT.dateFormat;
37
-
38
- const styles = storyStyles(COLORS, FONT_SIZE);
28
+ const styles = storyStyles(theme);
39
29
  const containerStyle = StyleSheet.flatten([
40
30
  styles.container,
41
31
  { paddingHorizontal: props.horizontalPadding },
@@ -44,47 +34,13 @@ export const PrimaryStoryCard = (props) => {
44
34
  styles.headline,
45
35
  props.headlineStyle,
46
36
  ]);
47
- const autorStyle = StyleSheet.flatten([
48
- styles.autorText,
49
- props.authorTextStyle,
50
- ]);
51
37
 
52
- const name = get(story.authors, [0, 'name']);
53
- const authorName = name ? `${translate('By')} ${name} | ` : '';
54
- const readTime = enableReadTimeOnStoryCards && story['read-time']
55
- ? `${story['read-time']} ${translate('min read')}`
56
- : '';
38
+ const isPremiumStory = story['access'] === 'subscription';
57
39
 
58
40
  const throttledOnpress = throttle(props.onPress, 1000);
59
41
 
60
- const showIcon = (name) => (
61
- <View style={styles.storyType}>
62
- <Icon name={name} size={22} color={COLORS.MONO7} />
63
- </View>
64
- );
65
-
66
- const showLiveBlogIcon = () => (
67
- <View style={styles.storyType}>
68
- <View style={styles.liveBlogIcon} />
69
- <Text style={styles.liveBlogText}>LIVE</Text>
70
- </View>
71
- );
72
- const showStoryType = () => {
73
- switch (story['story-template']) {
74
- case 'text':
75
- return null;
76
- case 'photo':
77
- return showIcon('photo');
78
- case 'video':
79
- return showIcon('play');
80
- case 'live-blog':
81
- return showLiveBlogIcon();
82
- default:
83
- null;
84
- }
85
- };
86
-
87
42
  return (
43
+ <>
88
44
  <TouchableOpacity
89
45
  testID={COMP_GENERAL_CONSTANTS.primaryStoryCard}
90
46
  onPress={throttledOnpress}
@@ -97,54 +53,53 @@ export const PrimaryStoryCard = (props) => {
97
53
  cdn={props.cdn}
98
54
  imageWidth={props.imageWidth}
99
55
  >
100
- <Text style={styles.xminContainer}>
101
- {readTime && (
102
- <View style={styles.xmin}>
103
- <Text style={styles.xminText}>{readTime}</Text>
104
- </View>
105
- )}
106
- </Text>
107
- <View style={styles.storyTypeContainer}>{showStoryType()}</View>
56
+ <View style={styles.storyTypeContainer}>
57
+ <StoryTemplateIcon storyTemplate={story['story-template']} cardType="primary" theme={theme} />
58
+ </View>
108
59
  </ResponsiveImage>
109
- <Text
110
- style={autorStyle}
111
- numberOfLines={2}
112
- // TODO: Add corrected testID here
113
- testID={COMP_CONTENT_CONSTANTS.authorName}
114
- >
115
- {authorName
116
- + getTimeForStoryCards(
117
- story['published-at'],
118
- DATE_FORMAT,
119
- locale,
120
- translate,
121
- reverseTimeAdverbPosition,
122
- )}
123
- </Text>
124
- <Text
125
- primary
126
- numberOfLines={3}
127
- ellipsizeMode="tail"
128
- style={headlineStyle}
129
- testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
130
- >
131
- {getStoryHeadline(story)}
132
- </Text>
60
+ <View style={styles.contentContainer}>
61
+ <View style={styles.headlineAndTimestampContainer}>
62
+ {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
63
+ <View style={{display:'flex', flexDirection:'row'}}>
64
+ <Text
65
+ primary
66
+ numberOfLines={storyCardOptions.numberOfLinesForTitle}
67
+ ellipsizeMode="tail"
68
+ style={headlineStyle}
69
+ testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
70
+ >
71
+ {isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h2} /> }
72
+ {isPremiumStory && premiumIcon !=='none' && ' '}
73
+ {getStoryHeadline(story)}
74
+ </Text>
75
+ </View>
76
+ <StoryCardDetailsRow
77
+ authorName={get(story.authors, [0, 'name'])}
78
+ publishedAt={story["published-at"]}
79
+ readTime={story['read-time']}
80
+ />
81
+ </View>
82
+ <View style={styles.icon}>{props.iconComponent}</View>
83
+ </View>
133
84
  </TouchableOpacity>
85
+ <View style={[styles.separatorLine, {marginHorizontal: props.horizontalPadding}]}/>
86
+ </>
134
87
  );
135
88
  };
136
89
 
137
- PrimaryStoryCard.propTypes = {
90
+ PrimaryStoryCardBase.propTypes = {
138
91
  cdn: PropTypes.string,
139
92
  imageWidth: PropTypes.number,
140
93
  headlineStyle: PropTypes.func,
141
- authorTextStyle: PropTypes.func,
142
94
  story: PropTypes.object.isRequired,
143
95
  onPress: PropTypes.func,
144
96
  horizontalPadding: PropTypes.number,
97
+ iconComponent: PropTypes.element,
145
98
  };
146
99
 
147
- PrimaryStoryCard.defaultProps = {
100
+ PrimaryStoryCardBase.defaultProps = {
148
101
  cdn: '',
149
102
  horizontalPadding: 12,
150
103
  };
104
+
105
+ export const PrimaryStoryCard = memo(PrimaryStoryCardBase);