@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
@@ -1,66 +1,47 @@
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',
40
35
  bottom: 0,
41
36
  left: 0,
42
37
  },
43
- storyType: {
44
- backgroundColor: COLORS.MONO1,
45
- padding: 8,
46
- justifyContent: 'space-between',
47
- alignItems: 'space-between',
48
- flexDirection: 'row',
49
- },
50
- storyTypeText: {
51
- color: COLORS.MONO7,
52
- fontSize: FONT_SIZE.h5,
53
- },
54
- liveBlogText: {
55
- color: COLORS.MONO7,
56
- fontSize: FONT_SIZE.h4,
57
- marginLeft: 10,
58
- fontWeight: 'bold',
38
+ premiumIcon: {
39
+ marginTop: FONT_SIZE.h3 * 0.92,
40
+ marginRight: 5,
59
41
  },
60
- liveBlogIcon: {
61
- height: 15,
62
- width: 15,
63
- borderRadius: 50,
64
- backgroundColor: COLORS.BRAND_3,
42
+ separatorLine: {
43
+ height: 0.8,
44
+ opacity: 0.1,
45
+ backgroundColor: COLORS.BRAND_BLACK,
65
46
  },
66
47
  });
@@ -1,13 +1,13 @@
1
+ import PropTypes from "prop-types";
1
2
  import React, { useContext } from "react";
2
3
  import {
3
4
  StyleSheet,
4
- View,
5
5
  TouchableOpacity,
6
+ View,
6
7
  ViewPropTypes,
7
8
  } from "react-native";
8
- import PropTypes from "prop-types";
9
- import { radioButtonStyles } from "./styles";
10
9
  import { AppTheme } from "../../utils";
10
+ import { radioButtonStyles } from "./styles";
11
11
 
12
12
  import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants";
13
13
 
@@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import { View } from 'react-native';
4
4
  import { StarRatingDisplay } from 'react-native-star-rating-widget';
5
+ import { AppTheme } from '../../utils';
5
6
  import { Text } from '../Text';
6
7
  import { ratingStyles } from './styles';
7
- import { AppTheme } from '../../utils';
8
8
 
9
9
  export const RatingLayout = ({ reviewTitle, ratingValue, ratingLabel }) => {
10
10
  const { theme } = useContext(AppTheme);
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import React, { useContext } from 'react';
4
4
  import { Text, View ,I18nManager} from 'react-native';
5
5
  import { getScreenPercentageWidth, AppTheme } from '../../utils/index';
6
- import { SecondaryStoryCard, SecondaryStoryCardNew, ShareButton } from '../index';
6
+ import { SecondaryStoryCard, ShareButton } from '../index';
7
7
 
8
8
  import { relatedStoriesStyles } from './styles';
9
9
 
@@ -13,10 +13,8 @@ export const RelatedStoriesCard = ({
13
13
  cdn,
14
14
  stories,
15
15
  onStoryPress,
16
- collectionTestID,
17
16
  RelatedCardID,
18
17
  title,
19
- switchToNewDesign,
20
18
  }) => {
21
19
  const sliceLimit = 5;
22
20
 
@@ -41,19 +39,12 @@ export const RelatedStoriesCard = ({
41
39
  onPress: () => onStoryPress(secondaryStory),
42
40
  key: secondaryStory?.id,
43
41
  };
44
- return switchToNewDesign ? (
45
- <SecondaryStoryCardNew
42
+ <SecondaryStoryCard
46
43
  {...storyCardProps}
47
44
  iconComponent={<ShareButton story={secondaryStory} inListingStoryCard />}
48
45
  imageWidth={getScreenPercentageWidth(28)}
49
46
  horizontalPadding={4}
50
47
  />
51
- ) : (
52
- <SecondaryStoryCard
53
- {...storyCardProps}
54
- imageWidth={getScreenPercentageWidth(40)}
55
- />
56
- );
57
48
  })}
58
49
  </View>
59
50
  </>
@@ -66,5 +57,4 @@ RelatedStoriesCard.propTypes = {
66
57
  collectionTestID: PropTypes.string,
67
58
  RelatedCardID: PropTypes.string,
68
59
  title:PropTypes.string,
69
- switchToNewDesign: PropTypes.bool,
70
60
  };
@@ -1,46 +1,38 @@
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, { useContext, memo } from 'react';
5
4
  import {
6
- Image,
7
5
  StyleSheet,
8
6
  TouchableOpacity,
9
7
  View,
10
8
  TextStyle,
11
9
  TouchableOpacityProps,
12
10
  } from 'react-native';
13
- import Icon from 'react-native-vector-icons/FontAwesome';
14
11
  import {
15
12
  AppTheme,
16
13
  getImageMetadata,
17
14
  getImageSlug,
18
- getTimeForStoryCards,
19
15
  } from '../../utils';
20
16
  import { getStoryHeadline } from '../../utils/story';
21
- import { ResponsiveImage, Text } from '../index';
22
- import { secStoryCardStyles } from './styles';
17
+ import { ResponsiveImage, Text, StoryCardDetailsRow, StoryTemplateIcon } from '../index';
18
+ import { storyStyles } from './styles';
23
19
  import {
24
20
  COMP_GENERAL_CONSTANTS,
25
21
  COMP_CONTENT_CONSTANTS,
26
22
  } from '../../constants/component-constants';
23
+ import PremiumIcons from '../../Icons/PremiumIcons/index';
27
24
 
28
- export const SecondaryStoryCard = (props) => {
25
+ const SecondaryStoryCardBase = (props) => {
26
+ const { story = {} } = props;
29
27
  const { theme } = useContext(AppTheme);
30
- const translate = get(theme, ['translate'], (word) => word);
31
-
32
28
  const {
33
- locale,
34
29
  COLORS,
35
- reverseTimeAdverbPosition,
36
- enableReadTimeOnStoryCards,
37
- DATE_TIME_FORMAT,
30
+ premiumIcon,
31
+ FONT_SIZE,
32
+ storyCardOptions = {},
38
33
  } = theme;
39
- const styles = secStoryCardStyles(theme);
40
- const { story = {} } = props;
41
-
42
- const DATE_FORMAT = DATE_TIME_FORMAT.dateFormat;
43
34
 
35
+ const styles = storyStyles(theme);
44
36
  const containerStyle = StyleSheet.flatten([
45
37
  styles.container,
46
38
  { paddingHorizontal: props.horizontalPadding },
@@ -49,114 +41,73 @@ export const SecondaryStoryCard = (props) => {
49
41
  styles.headline,
50
42
  props.headlineStyle,
51
43
  ]);
52
- const authorTextStyle = StyleSheet.flatten([
53
- styles.authorText,
54
- props.dateTextStyle,
55
- ]);
56
- const iconStyles = StyleSheet.flatten([styles.iconStyles, props.iconStyle]);
57
44
 
58
- const name = get(story.authors, [0, 'name']);
59
- const authorName = name ? `${translate('By')} ${name} | ` : '';
60
- const readTime = enableReadTimeOnStoryCards && story['read-time']
61
- ? `${story['read-time']} ${translate('min read')}`
62
- : '';
45
+ const isPremiumStory = story['access'] === 'subscription';
63
46
 
64
47
  const throttledOnpress = throttle(props.onPress, 1000);
65
48
 
66
- const showIcon = (name) => (
67
- <View style={styles.storyType}>
68
- <Icon name={name} size={14} color={COLORS.MONO7} />
69
- </View>
70
- );
71
-
72
- const showLiveBlogIcon = () => (
73
- <View style={styles.storyType}>
74
- <View style={styles.liveBlogIcon} />
75
- <Text style={styles.liveBlogText}>LIVE</Text>
76
- </View>
77
- );
78
-
79
- const showStoryType = () => {
80
- switch (story['story-template']) {
81
- case 'text':
82
- return null;
83
- case 'photo':
84
- return showIcon('photo');
85
- case 'video':
86
- return showIcon('play');
87
- case 'live-blog':
88
- return showLiveBlogIcon();
89
- default:
90
- null;
91
- }
92
- };
93
-
94
49
  return (
95
- <TouchableOpacity
96
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
97
- onPress={throttledOnpress}
98
- activeOpacity={0.8}
99
- style={containerStyle}
100
- >
101
- <ResponsiveImage
102
- metaData={getImageMetadata(story)}
103
- slug={getImageSlug(story) || ''}
104
- cdn={props.cdn || ''}
105
- imageWidth={props.imageWidth}
50
+ <>
51
+ <TouchableOpacity
52
+ testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
53
+ onPress={throttledOnpress}
54
+ activeOpacity={0.8}
55
+ style={containerStyle}
106
56
  >
107
- <Text style={styles.xminContainer}>
108
- {readTime && (
109
- <View style={styles.xmin}>
110
- <Text style={styles.xminText}>{readTime}</Text>
111
- </View>
112
- )}
113
- </Text>
114
- <View style={styles.storyTypeContainer}>{showStoryType()}</View>
115
- </ResponsiveImage>
116
- <View style={styles.headlineAndAuthorBlockContainer}>
117
- <Text
118
- primary
119
- numberOfLines={3}
120
- ellipsizeMode="tail"
121
- style={headlineStyle}
122
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
123
- >
124
- {getStoryHeadline(story)?.trim()}
125
- </Text>
126
- <View style={styles.authorAndIconContainer}>
127
- <Text
128
- style={authorTextStyle}
129
- numberOfLines={2}
130
- testID={COMP_CONTENT_CONSTANTS.authorName}
57
+ <View style={[styles.imageAndDetails, storyCardOptions.alignSmallCardImage === "right" && { flexDirection: 'row-reverse' }]}>
58
+ {storyCardOptions.enableSmallCardImage && (<ResponsiveImage
59
+ styles={styles.image}
60
+ metaData={getImageMetadata(story)}
61
+ slug={getImageSlug(story) || ''}
62
+ cdn={props.cdn || ''}
63
+ imageWidth={props.imageWidth}
131
64
  >
132
- {authorName
133
- + getTimeForStoryCards(
134
- story['published-at'],
135
- DATE_FORMAT,
136
- locale,
137
- translate,
138
- reverseTimeAdverbPosition,
139
- )}
140
- </Text>
141
- <View style={iconStyles}>{props.iconComponent}</View>
65
+ <View style={styles.storyTypeContainer}>
66
+ <StoryTemplateIcon storyTemplate={story['story-template']} theme={theme} />
67
+ </View>
68
+ </ResponsiveImage>)
69
+ }
70
+ <View style={styles.headlineAndTimestampBlockContainer}>
71
+ {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
72
+ <View style={{ display: 'flex', flexDirection: 'row' }}>
73
+ <Text
74
+ primary
75
+ numberOfLines={storyCardOptions.numberOfLinesForTitle}
76
+ ellipsizeMode="tail"
77
+ style={headlineStyle}
78
+ testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
79
+ >
80
+ {isPremiumStory && premiumIcon !== 'none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h4} />}
81
+ {isPremiumStory && premiumIcon !== 'none' && ' '}
82
+ {getStoryHeadline(story)?.trim()}
83
+ </Text>
84
+ </View>
85
+ <StoryCardDetailsRow
86
+ authorName={get(story.authors, [0, 'name'])}
87
+ publishedAt={story["published-at"]}
88
+ readTime={story['read-time']}
89
+ />
90
+ </View>
142
91
  </View>
143
- </View>
144
- </TouchableOpacity>
92
+ <View style={styles.icon}>{props.iconComponent}</View>
93
+ </TouchableOpacity>
94
+ <View style={[styles.separatorLine, { marginHorizontal: props.horizontalPadding }]} />
95
+ </>
145
96
  );
146
97
  };
147
98
 
148
- SecondaryStoryCard.propTypes = TouchableOpacityProps && {
99
+ SecondaryStoryCardBase.propTypes = TouchableOpacityProps && {
149
100
  cdn: PropTypes.string.isRequired,
150
- imageStyle: Image.style,
151
101
  imageWidth: PropTypes.number,
152
102
  headlineStyle: TextStyle,
153
- dateTextStyle: TextStyle,
154
103
  story: PropTypes.any.isRequired,
155
104
  iconComponent: PropTypes.element,
156
105
  horizontalPadding: PropTypes.number,
157
106
  };
158
107
 
159
- SecondaryStoryCard.defaultProps = {
108
+ SecondaryStoryCardBase.defaultProps = {
160
109
  cdn: '',
161
110
  horizontalPadding: 12,
162
111
  };
112
+
113
+ export const SecondaryStoryCard = memo(SecondaryStoryCardBase);
@@ -1,79 +1,59 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
- export const secStoryCardStyles = ({ COLORS, FONT_SIZE, DARK_MODE }) => StyleSheet.create({
3
+ export const storyStyles = ({ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {} }) => StyleSheet.create({
4
4
  container: {
5
5
  flexDirection: 'row',
6
+ justifyContent: 'space-between',
6
7
  backgroundColor: COLORS.BRAND_WHITE,
7
- paddingVertical: 15,
8
+ paddingVertical: 10,
9
+ alignItems: 'flex-start',
10
+ gap: 10,
8
11
  },
9
- headlineAndAuthorBlockContainer: {
12
+ imageAndDetails: {
13
+ flexDirection: 'row',
10
14
  flexShrink: 1,
11
- flex: 1,
12
- justifyContent: 'space-between',
13
- paddingHorizontal: 10,
15
+ alignItems: 'flex-start',
16
+ gap: 10,
14
17
  },
15
- authorAndIconContainer: {
16
- flexDirection: 'row',
18
+ image: {
19
+ marginBottom: 4,
20
+ marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
21
+ },
22
+ icon: {
23
+ marginBottom: 4,
24
+ marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
25
+ },
26
+ headlineAndTimestampBlockContainer: {
27
+ flexShrink: 1,
28
+ flexGrow: 1,
29
+ gap: 4,
17
30
  justifyContent: 'space-between',
18
31
  },
19
- authorText: {
20
- color: COLORS.BRAND_BLACK,
21
- fontSize: FONT_SIZE.h6,
22
- lineHeight: FONT_SIZE.h6 * 1.3,
23
- opacity: 0.5,
24
- fontWeight: '500',
25
- paddingTop: 8,
32
+ sectionName: {
33
+ color: COLORS.BRAND_1,
34
+ fontSize: FONT_SIZE.h4,
35
+ lineHeight: FONT_SIZE.h4 * lineHeightMultiplier,
26
36
  },
27
37
  headline: {
28
38
  color: COLORS.BRAND_BLACK,
29
- opacity: 0.9,
30
39
  flexWrap: 'wrap',
31
40
  fontSize: FONT_SIZE.h3,
32
- lineHeight: FONT_SIZE.h3 * 1.5,
33
- },
34
- iconStyles: {
35
- justifyContent: 'flex-end',
36
- },
37
- xminContainer: {
38
- position: 'absolute',
39
- bottom: 8,
40
- right: 8,
41
- },
42
- xmin: {
43
- backgroundColor: DARK_MODE ? COLORS.MONO6 : COLORS.BRAND_WHITE,
44
- paddingLeft: 8,
45
- paddingRight: 8,
46
- },
47
- xminText: {
48
- color: COLORS.BRAND_BLACK,
49
- fontSize: FONT_SIZE.h5,
41
+ fontFamily: FONT_FAMILY.primaryBold,
42
+ lineHeight: FONT_SIZE.h3 * lineHeightMultiplier,
43
+ marginBottom: 4,
50
44
  },
51
45
  storyTypeContainer: {
52
46
  position: 'absolute',
53
- backgroundColor: COLORS.MONO1,
54
47
  bottom: 0,
55
48
  left: 0,
56
49
  },
57
- storyType: {
58
- padding: 5,
59
- justifyContent: 'space-between',
60
- alignItems: 'center',
61
- flexDirection: 'row',
62
- },
63
- storyTypeText: {
64
- color: COLORS.MONO7,
65
- fontSize: FONT_SIZE.h5,
66
- },
67
- liveBlogText: {
68
- color: COLORS.MONO7,
69
- fontSize: FONT_SIZE.h5,
70
- marginLeft: 4,
71
- fontWeight: 'bold',
50
+ premiumIcon: {
51
+ marginTop: FONT_SIZE.h3 * 0.45,
52
+ marginRight: 3,
72
53
  },
73
- liveBlogIcon: {
74
- height: 12,
75
- width: 12,
76
- borderRadius: 50,
77
- backgroundColor: COLORS.BRAND_3,
54
+ separatorLine: {
55
+ height: 0.8,
56
+ opacity: 0.1,
57
+ backgroundColor: COLORS.BRAND_BLACK,
78
58
  },
79
59
  });
@@ -1,20 +1,19 @@
1
+ import { hexToRgb } from '@quintype/native-components/src/utils/colorUtils';
1
2
  import PropTypes from 'prop-types';
2
- import React, { useEffect, useContext } from 'react';
3
- import { View, I18nManager, TouchableOpacity } from 'react-native';
4
- import { Text } from '../index';
5
- import { StoryHeader } from '../StoryHeader';
3
+ import React, { useContext, useEffect } from 'react';
4
+ import { I18nManager, View } from 'react-native';
5
+ import LinearGradient from "react-native-linear-gradient";
6
+ import { ClockIcon } from '../../Icons/ClockIcon';
7
+ import { AppTheme, getTimeInFormat } from '../../utils';
8
+ import { isMiddleIndexOfArray } from '../../utils/arrayUtils';
9
+ import { getFirstVideoElement, isStoryFree } from '../../utils/story';
10
+ import { STORY_TYPES } from '../../utils/story-types';
11
+ import { FBCommentsRow } from '../FBCommentsRow';
6
12
  import { StoryContent } from '../StoryContent';
13
+ import { StoryHeader } from '../StoryHeader';
7
14
  import { TagsRow } from '../TagsRow/TagsRow';
8
- import { FBCommentsRow } from '../FBCommentsRow';
9
- import { STORY_TYPES } from '../../utils/story-types';
10
- import { getTimeInFormat, AppTheme } from '../../utils';
11
- import { ShareButton } from '../index';
12
- import { ClockIcon } from '../../Icons/ClockIcon';
15
+ import { ShareButton, Text } from '../index';
13
16
  import { storyStyles } from './styles';
14
- import { isStoryFree, getFirstVideoElement } from '../../utils/story';
15
- import { isMiddleIndexOfArray } from '../../utils/arrayUtils';
16
- import LinearGradient from "react-native-linear-gradient";
17
- import { hexToRgb } from '@quintype/native-components/src/utils/colorUtils';
18
17
 
19
18
  const getLiveBlogTimeStamp = (card, DATE_FORMAT, story, styles, locale) => {
20
19
  const slug = `?cardId=${card.id}`;
@@ -1,25 +1,25 @@
1
1
  import get from 'lodash/get';
2
2
  import PropTypes from 'prop-types';
3
3
  import React, { useContext } from 'react';
4
- import { TouchableOpacity, View, I18nManager,StyleSheet } from 'react-native';
4
+ import { TouchableOpacity, View } from 'react-native';
5
+ import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
5
6
  import {
7
+ AppTheme,
6
8
  getImageMetadata,
7
9
  getScreenPercentageWidth,
8
- getTimeInFormat,
9
- AppTheme,
10
- stripHTML,
10
+ getTimeInFormat
11
11
  } from '../../utils';
12
12
  import { STORY_TYPES } from '../../utils/story-types';
13
+ import { YouTubePlayer } from '../YouTubePlayer';
13
14
  import {
14
- AuthorRow, ResponsiveImage, StoryText, StoryTitle, Text,
15
+ AuthorRow, ResponsiveImage,
16
+ StoryTitle, Text
15
17
  } from '../index';
16
- import { YouTubePlayer } from '../YouTubePlayer';
17
18
  import { storyHeaderStyles } from './styles';
18
- import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
19
19
 
20
20
  import { DailyMotionPlayer } from '../DailyMotionPlayer';
21
21
  import { RatingLayout } from '../Rating';
22
- import CustomHtmlParser from './../Html/index';
22
+ import CustomHtmlParser from './../Html/index';
23
23
 
24
24
  const getHeroImage = (cdn, story) => {
25
25
  const imageSlug = story['hero-image-s3-key'];
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import FAIcon from "react-native-vector-icons/FontAwesome";
4
+ import MaterialIcon from "react-native-vector-icons/MaterialIcons";
5
+ import { Text } from "../index";
6
+ import { storyTemplateIconStyles } from "./styles";
7
+
8
+ export const StoryTemplateIcon = ({
9
+ storyTemplate,
10
+ cardType = "secondary",
11
+ theme,
12
+ }) => {
13
+ const { COLORS, FONT_SIZE } = theme;
14
+
15
+ const styles = storyTemplateIconStyles(COLORS, FONT_SIZE, cardType);
16
+
17
+ const iconSize = () => {
18
+ switch (cardType) {
19
+ case "primary":
20
+ return 20;
21
+ case "secondary":
22
+ default:
23
+ return 14;
24
+ }
25
+ };
26
+
27
+ const showIcon = (name, iconFamily = "FontAwesome") => (
28
+ <View style={styles.storyType}>
29
+ {iconFamily === "MaterialIcons" ? (
30
+ <MaterialIcon name={name} size={iconSize()} color={COLORS.MONO7} />
31
+ ) : (
32
+ <FAIcon name={name} size={iconSize()} color={COLORS.MONO7} />
33
+ )}
34
+ </View>
35
+ );
36
+
37
+ const showLiveBlogIcon = () => (
38
+ <View style={styles.storyType}>
39
+ <View style={styles.liveBlogIcon} />
40
+ <Text style={styles.liveBlogText}>LIVE</Text>
41
+ </View>
42
+ );
43
+
44
+ switch (storyTemplate) {
45
+ case "text":
46
+ return null;
47
+ case "photo":
48
+ return showIcon("photo");
49
+ case "video":
50
+ return showIcon("play");
51
+ case "live-blog":
52
+ return showLiveBlogIcon();
53
+ case "visual-story":
54
+ return showIcon("web-stories", "MaterialIcons");
55
+ default:
56
+ return null;
57
+ }
58
+ };
@@ -0,0 +1,23 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const storyTemplateIconStyles = (COLORS, FONT_SIZE, cardType) => StyleSheet.create({
4
+ storyType: {
5
+ backgroundColor: COLORS.MONO1,
6
+ padding: cardType === "primary" ? 8 : 4,
7
+ justifyContent: 'space-between',
8
+ alignItems: 'space-between',
9
+ flexDirection: 'row',
10
+ },
11
+ liveBlogText: {
12
+ color: COLORS.MONO7,
13
+ fontSize: FONT_SIZE.h5,
14
+ marginLeft: cardType === "primary" ? 8 : 4,
15
+ fontWeight: 'bold',
16
+ },
17
+ liveBlogIcon: {
18
+ height: 12,
19
+ width: 12,
20
+ borderRadius: 50,
21
+ backgroundColor: COLORS.BRAND_3,
22
+ },
23
+ });
@@ -1,11 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import {
4
- View, StyleSheet, Linking, Text, I18nManager,
4
+ I18nManager,
5
+ StyleSheet,
6
+ Text,
7
+ View
5
8
  } from 'react-native';
6
9
  import HTML from 'react-native-render-html';
7
- import { AppTheme } from '../../utils/context';
8
10
  import { customHTMLStyles } from '../../constants/renderHTML';
11
+ import { AppTheme } from '../../utils/context';
9
12
 
10
13
  import { storyTextStyles } from './styles';
11
14