@quintype/native-components 2.22.4 → 2.22.5-beta.0

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 (44) 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 +19 -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 +8 -7
  17. package/src/components/PrimaryStoryCard/index.js +44 -63
  18. package/src/components/PrimaryStoryCard/styles.js +32 -28
  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 +37 -62
  23. package/src/components/SecondaryStoryCard/styles.js +37 -34
  24. package/src/components/Story/index.js +12 -13
  25. package/src/components/StoryHeader/index.js +8 -8
  26. package/src/components/StoryText/index.js +5 -2
  27. package/src/components/Text/index.js +3 -1
  28. package/src/components/TextA/index.js +4 -4
  29. package/src/components/TextBigFact/index.js +4 -4
  30. package/src/components/TextBlockQuote/index.js +5 -5
  31. package/src/components/TextBlurb/index.js +3 -3
  32. package/src/components/TextQandA/index.js +2 -3
  33. package/src/components/index.js +0 -4
  34. package/src/components/CollectionCardNew/index.js +0 -84
  35. package/src/components/CollectionTitle/CollectionTitle.test.js +0 -12
  36. package/src/components/CollectionTitle/__snapshots__/CollectionTitle.test.js.snap +0 -3
  37. package/src/components/CollectionTitleNew/index.js +0 -44
  38. package/src/components/CollectionTitleNew/styles.js +0 -20
  39. package/src/components/PrimaryStoryCard/PrimaryStoryCard.test.js +0 -43
  40. package/src/components/PrimaryStoryCardNew/index.js +0 -134
  41. package/src/components/PrimaryStoryCardNew/styles.js +0 -70
  42. package/src/components/SecondaryStoryCard/SecondaryStoryCard.test.js +0 -51
  43. package/src/components/SecondaryStoryCardNew/index.js +0 -140
  44. 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.4",
3
+ "version": "2.22.5-beta.0",
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,42 @@
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
10
6
  } from 'react-native';
11
-
12
- import { Text } from '../index';
13
-
14
- import { collectionStyles } from './styles';
15
7
  import { AppTheme } from '../../utils';
16
- import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
8
+ import { Text } from '../index';
9
+ import { collectionTitleStyles } from './styles';
17
10
 
18
- export const CollectionTitle = (props) => {
11
+ const CollectionTitleBase = (props) => {
19
12
  const { theme } = useContext(AppTheme);
20
- const styles = collectionStyles(theme);
13
+ const styles = collectionTitleStyles(theme);
21
14
  const containerStyle = StyleSheet.flatten([
22
- styles.titleContainer,
15
+ styles.container,
23
16
  { paddingHorizontal: props.horizontalPadding },
24
17
  ]);
25
- const titleStyle = StyleSheet.flatten([styles.titleStyle, props.titleStyle]);
26
- const indicatorStyle = StyleSheet.flatten([
27
- styles.indicatorStyle,
28
- props.indicatorStyle,
29
- ]);
18
+ const titleStyle = StyleSheet.flatten([styles.title, props.titleStyle]);
30
19
 
31
20
  if (!props.title) {
32
21
  return null;
33
22
  }
34
23
 
35
24
  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} />
25
+ <TouchableOpacity style={containerStyle} onPress={props.onPress}>
26
+ <Text style={titleStyle}>{props.title}</Text>
48
27
  </TouchableOpacity>
49
28
  );
50
29
  };
51
30
 
52
- CollectionTitle.propTypes = TouchableOpacityProps && {
53
- title: PropTypes.string,
54
- titleStyle: TextStyle,
55
- indicatorStyle: ViewStyle,
56
- horizontalPadding: PropTypes.number,
57
- };
31
+ CollectionTitleBase.propTypes = TouchableOpacityProps
32
+ && {
33
+ title: PropTypes.string,
34
+ titleStyle: TextStyle,
35
+ horizontalPadding: PropTypes.number,
36
+ };
58
37
 
59
- CollectionTitle.defaultProps = {
38
+ CollectionTitleBase.defaultProps = {
60
39
  horizontalPadding: 12,
61
40
  };
41
+
42
+ 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,20 +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,
8
+ TouchableOpacity,
9
+ View
9
10
  } from 'react-native';
11
+ import Pdf from 'react-native-pdf';
10
12
  import IonIcon from 'react-native-vector-icons/Ionicons';
11
13
  import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
12
- import Pdf from 'react-native-pdf';
13
14
 
14
- import { Text } from '../index';
15
- import { pdfStyles } from './styles';
16
- import { ShareButton } from '../index';
17
15
  import { AppTheme } from '../../utils';
16
+ import { ShareButton, Text } from '../index';
17
+ import { pdfStyles } from './styles';
18
18
 
19
19
  export const PDFReader = ({ card, story }) => {
20
20
  const [modalVisible, setModalVisible] = useState(false);
@@ -55,6 +55,7 @@ export const PDFReader = ({ card, story }) => {
55
55
  console.warn(error);
56
56
  }}
57
57
  style={styles.pdfStyle}
58
+ trustAllCerts={Platform.OS === 'ios'}
58
59
  />
59
60
  </Modal>
60
61
  <View style={styles.pdfContainer}>
@@ -1,41 +1,32 @@
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
5
  import Icon from 'react-native-vector-icons/FontAwesome';
6
+ import PremiumIcons from '../../Icons/PremiumIcons/index';
7
+ import {
8
+ COMP_GENERAL_CONSTANTS,
9
+ } from '../../constants/component-constants';
7
10
  import {
8
11
  AppTheme,
9
12
  getImageMetadata,
10
13
  getImageSlug,
11
- getTimeForStoryCards,
12
14
  } from '../../utils';
13
15
  import { getStoryHeadline } from '../../utils/story';
14
- import { ResponsiveImage, Text } from '../index';
16
+ import { ResponsiveImage, StoryCardDetailsRow, Text } from '../index';
15
17
  import { storyStyles } from './styles';
16
- import {
17
- COMP_GENERAL_CONSTANTS,
18
- COMP_CONTENT_CONSTANTS,
19
- } from '../../constants/component-constants';
20
18
 
21
- export const PrimaryStoryCard = (props) => {
19
+ const PrimaryStoryCardBase = (props) => {
22
20
  const { story = {} } = props;
23
21
  const { theme } = useContext(AppTheme);
24
-
25
- const translate = get(theme, ['translate'], (word) => word);
26
-
27
22
  const {
28
23
  COLORS,
29
24
  FONT_SIZE,
30
- locale,
31
- reverseTimeAdverbPosition,
32
- enableReadTimeOnStoryCards,
33
- DATE_TIME_FORMAT,
25
+ premiumIcon,
26
+ storyCardOptions = {},
34
27
  } = theme || {};
35
28
 
36
- const DATE_FORMAT = DATE_TIME_FORMAT.dateFormat;
37
-
38
- const styles = storyStyles(COLORS, FONT_SIZE);
29
+ const styles = storyStyles(theme);
39
30
  const containerStyle = StyleSheet.flatten([
40
31
  styles.container,
41
32
  { paddingHorizontal: props.horizontalPadding },
@@ -44,16 +35,8 @@ export const PrimaryStoryCard = (props) => {
44
35
  styles.headline,
45
36
  props.headlineStyle,
46
37
  ]);
47
- const autorStyle = StyleSheet.flatten([
48
- styles.autorText,
49
- props.authorTextStyle,
50
- ]);
51
38
 
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
- : '';
39
+ const isPremiumStory = story['access'] === 'subscription';
57
40
 
58
41
  const throttledOnpress = throttle(props.onPress, 1000);
59
42
 
@@ -85,6 +68,7 @@ export const PrimaryStoryCard = (props) => {
85
68
  };
86
69
 
87
70
  return (
71
+ <>
88
72
  <TouchableOpacity
89
73
  testID={COMP_GENERAL_CONSTANTS.primaryStoryCard}
90
74
  onPress={throttledOnpress}
@@ -97,54 +81,51 @@ export const PrimaryStoryCard = (props) => {
97
81
  cdn={props.cdn}
98
82
  imageWidth={props.imageWidth}
99
83
  >
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
84
  <View style={styles.storyTypeContainer}>{showStoryType()}</View>
108
85
  </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>
86
+ <View style={styles.contentContainer}>
87
+ <View style={styles.headlineAndTimestampContainer}>
88
+ {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
89
+ <View style={{display:'flex', flexDirection:'row'}}>
90
+ <Text
91
+ primary
92
+ numberOfLines={storyCardOptions.numberOfLinesForTitle}
93
+ ellipsizeMode="tail"
94
+ style={headlineStyle}
95
+ testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
96
+ >
97
+ {isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h2} /> }
98
+ {isPremiumStory && premiumIcon !=='none' && ' '}
99
+ {getStoryHeadline(story)}
100
+ </Text>
101
+ </View>
102
+ <StoryCardDetailsRow
103
+ authorName={get(story.authors, [0, 'name'])}
104
+ publishedAt={story["published-at"]}
105
+ readTime={story['read-time']}
106
+ />
107
+ </View>
108
+ <View style={styles.icon}>{props.iconComponent}</View>
109
+ </View>
133
110
  </TouchableOpacity>
111
+ <View style={[styles.separatorLine, {marginHorizontal: props.horizontalPadding}]}/>
112
+ </>
134
113
  );
135
114
  };
136
115
 
137
- PrimaryStoryCard.propTypes = {
116
+ PrimaryStoryCardBase.propTypes = {
138
117
  cdn: PropTypes.string,
139
118
  imageWidth: PropTypes.number,
140
119
  headlineStyle: PropTypes.func,
141
- authorTextStyle: PropTypes.func,
142
120
  story: PropTypes.object.isRequired,
143
121
  onPress: PropTypes.func,
144
122
  horizontalPadding: PropTypes.number,
123
+ iconComponent: PropTypes.element,
145
124
  };
146
125
 
147
- PrimaryStoryCard.defaultProps = {
126
+ PrimaryStoryCardBase.defaultProps = {
148
127
  cdn: '',
149
128
  horizontalPadding: 12,
150
129
  };
130
+
131
+ export const PrimaryStoryCard = memo(PrimaryStoryCardBase);
@@ -1,39 +1,34 @@
1
- export const storyStyles = (COLORS = {}, FONT_SIZE = {}, DARK_MODE = {}) => ({
1
+ export const storyStyles = ({COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {}}) => ({
2
2
  container: {
3
3
  backgroundColor: COLORS.BRAND_WHITE,
4
- marginTop: 12,
4
+ paddingVertical: 10,
5
+ gap: 10,
5
6
  },
6
- autorText: {
7
- color: COLORS?.BRAND_6,
8
- fontSize: FONT_SIZE.h5,
9
- lineHeight: FONT_SIZE.h5 * 1.3,
10
- paddingVertical: 8,
11
- },
12
- divider: {
13
- backgroundColor: COLORS.BRAND_6,
14
- height: 12,
15
- marginHorizontal: 5,
16
- width: 1,
7
+ contentContainer: {
8
+ flexDirection: 'row',
9
+ justifyContent: 'space-between',
10
+ alignItems: 'flex-start',
11
+ gap: 10,
17
12
  },
18
- headline: {
19
- fontSize: FONT_SIZE.title,
20
- lineHeight: FONT_SIZE.title * 1.5,
21
- color: COLORS.BRAND_BLACK,
22
- opacity: 0.9,
13
+ headlineAndTimestampContainer: {
14
+ flexShrink: 1,
15
+ gap: 4,
23
16
  },
24
- xminContainer: {
25
- position: 'absolute',
26
- bottom: 8,
27
- right: 8,
17
+ icon: {
18
+ marginBottom: 4,
19
+ marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
28
20
  },
29
- xmin: {
30
- backgroundColor: DARK_MODE ? COLORS.MONO6 : COLORS.BRAND_WHITE,
31
- paddingLeft: 8,
32
- paddingRight: 8,
21
+ sectionName: {
22
+ color: COLORS.BRAND_1,
23
+ fontSize: FONT_SIZE.h4,
24
+ lineHeight: FONT_SIZE.h4 * lineHeightMultiplier,
33
25
  },
34
- xminText: {
26
+ headline: {
27
+ fontFamily: FONT_FAMILY.primaryBold,
28
+ fontSize: FONT_SIZE.title,
29
+ lineHeight: FONT_SIZE.title * lineHeightMultiplier,
35
30
  color: COLORS.BRAND_BLACK,
36
- fontSize: FONT_SIZE.h5,
31
+ marginBottom: 4,
37
32
  },
38
33
  storyTypeContainer: {
39
34
  position: 'absolute',
@@ -63,4 +58,13 @@ export const storyStyles = (COLORS = {}, FONT_SIZE = {}, DARK_MODE = {}) => ({
63
58
  borderRadius: 50,
64
59
  backgroundColor: COLORS.BRAND_3,
65
60
  },
61
+ premiumIcon: {
62
+ marginTop: FONT_SIZE.h3 * 0.92,
63
+ marginRight: 5,
64
+ },
65
+ separatorLine: {
66
+ height: 0.8,
67
+ opacity: 0.1,
68
+ backgroundColor: COLORS.BRAND_BLACK,
69
+ },
66
70
  });