@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
@@ -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,36 @@
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
- TextStyle,
11
- TouchableOpacityProps,
12
8
  } from 'react-native';
13
9
  import Icon from 'react-native-vector-icons/FontAwesome';
14
10
  import {
15
11
  AppTheme,
16
12
  getImageMetadata,
17
13
  getImageSlug,
18
- getTimeForStoryCards,
19
14
  } from '../../utils';
20
15
  import { getStoryHeadline } from '../../utils/story';
21
- import { ResponsiveImage, Text } from '../index';
22
- import { secStoryCardStyles } from './styles';
16
+ import { ResponsiveImage, Text, StoryCardDetailsRow } from '../index';
17
+ import { storyStyles } from './styles';
23
18
  import {
24
19
  COMP_GENERAL_CONSTANTS,
25
- COMP_CONTENT_CONSTANTS,
26
20
  } from '../../constants/component-constants';
21
+ import PremiumIcons from '../../Icons/PremiumIcons/index';
27
22
 
28
- export const SecondaryStoryCard = (props) => {
23
+ const SecondaryStoryCardBase = (props) => {
24
+ const { story = {} } = props;
29
25
  const { theme } = useContext(AppTheme);
30
- const translate = get(theme, ['translate'], (word) => word);
31
-
32
26
  const {
33
- locale,
34
27
  COLORS,
35
- reverseTimeAdverbPosition,
36
- enableReadTimeOnStoryCards,
37
- DATE_TIME_FORMAT,
28
+ premiumIcon,
29
+ FONT_SIZE,
30
+ storyCardOptions = {},
38
31
  } = theme;
39
- const styles = secStoryCardStyles(theme);
40
- const { story = {} } = props;
41
-
42
- const DATE_FORMAT = DATE_TIME_FORMAT.dateFormat;
43
32
 
33
+ const styles = storyStyles(theme);
44
34
  const containerStyle = StyleSheet.flatten([
45
35
  styles.container,
46
36
  { paddingHorizontal: props.horizontalPadding },
@@ -49,17 +39,8 @@ export const SecondaryStoryCard = (props) => {
49
39
  styles.headline,
50
40
  props.headlineStyle,
51
41
  ]);
52
- const authorTextStyle = StyleSheet.flatten([
53
- styles.authorText,
54
- props.dateTextStyle,
55
- ]);
56
- const iconStyles = StyleSheet.flatten([styles.iconStyles, props.iconStyle]);
57
42
 
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
- : '';
43
+ const isPremiumStory = story['access'] === 'subscription';
63
44
 
64
45
  const throttledOnpress = throttle(props.onPress, 1000);
65
46
 
@@ -92,71 +73,65 @@ export const SecondaryStoryCard = (props) => {
92
73
  };
93
74
 
94
75
  return (
76
+ <>
95
77
  <TouchableOpacity
96
78
  testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
97
79
  onPress={throttledOnpress}
98
80
  activeOpacity={0.8}
99
81
  style={containerStyle}
100
82
  >
101
- <ResponsiveImage
83
+ <View style={[styles.imageAndDetails, storyCardOptions.alignSmallCardImage === "right" && { flexDirection: 'row-reverse'}]}>
84
+ {storyCardOptions.enableSmallCardImage && (<ResponsiveImage
85
+ styles={styles.image}
102
86
  metaData={getImageMetadata(story)}
103
87
  slug={getImageSlug(story) || ''}
104
88
  cdn={props.cdn || ''}
105
89
  imageWidth={props.imageWidth}
106
90
  >
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
91
  <View style={styles.storyTypeContainer}>{showStoryType()}</View>
115
- </ResponsiveImage>
116
- <View style={styles.headlineAndAuthorBlockContainer}>
92
+ </ResponsiveImage>)
93
+ }
94
+ <View style={styles.headlineAndTimestampBlockContainer}>
95
+ {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
96
+ <View style={{display:'flex', flexDirection:'row'}}>
117
97
  <Text
118
98
  primary
119
- numberOfLines={3}
99
+ numberOfLines={storyCardOptions.numberOfLinesForTitle}
120
100
  ellipsizeMode="tail"
121
101
  style={headlineStyle}
122
102
  testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
123
103
  >
104
+ {isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h4} />}
105
+ {isPremiumStory && premiumIcon !=='none' && ' '}
124
106
  {getStoryHeadline(story)?.trim()}
125
107
  </Text>
126
- <View style={styles.authorAndIconContainer}>
127
- <Text
128
- style={authorTextStyle}
129
- numberOfLines={2}
130
- testID={COMP_CONTENT_CONSTANTS.authorName}
131
- >
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>
142
108
  </View>
109
+ <StoryCardDetailsRow
110
+ authorName={get(story.authors, [0, 'name'])}
111
+ publishedAt={story["published-at"]}
112
+ readTime={story['read-time']}
113
+ />
143
114
  </View>
115
+ </View>
116
+ <View style={styles.icon}>{props.iconComponent}</View>
144
117
  </TouchableOpacity>
118
+ <View style={[styles.separatorLine, { marginHorizontal: props.horizontalPadding }]}/>
119
+ </>
145
120
  );
146
121
  };
147
122
 
148
- SecondaryStoryCard.propTypes = TouchableOpacityProps && {
123
+ SecondaryStoryCardBase.propTypes = TouchableOpacityProps && {
149
124
  cdn: PropTypes.string.isRequired,
150
- imageStyle: Image.style,
151
125
  imageWidth: PropTypes.number,
152
126
  headlineStyle: TextStyle,
153
- dateTextStyle: TextStyle,
154
127
  story: PropTypes.any.isRequired,
155
128
  iconComponent: PropTypes.element,
156
129
  horizontalPadding: PropTypes.number,
157
130
  };
158
131
 
159
- SecondaryStoryCard.defaultProps = {
132
+ SecondaryStoryCardBase.defaultProps = {
160
133
  cdn: '',
161
134
  horizontalPadding: 12,
162
135
  };
136
+
137
+ export const SecondaryStoryCard = memo(SecondaryStoryCardBase);
@@ -1,52 +1,46 @@
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',
@@ -76,4 +70,13 @@ export const secStoryCardStyles = ({ COLORS, FONT_SIZE, DARK_MODE }) => StyleShe
76
70
  borderRadius: 50,
77
71
  backgroundColor: COLORS.BRAND_3,
78
72
  },
73
+ premiumIcon: {
74
+ marginTop: FONT_SIZE.h3 * 0.45,
75
+ marginRight: 3,
76
+ },
77
+ separatorLine: {
78
+ height: 0.8,
79
+ opacity: 0.1,
80
+ backgroundColor: COLORS.BRAND_BLACK,
81
+ },
79
82
  });
@@ -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'];
@@ -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
 
@@ -1,7 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import {
4
- Text as RNText, TextProps, StyleSheet, I18nManager,
4
+ I18nManager,
5
+ Text as RNText,
6
+ StyleSheet
5
7
  } from 'react-native';
6
8
 
7
9
  import { AppTheme } from '../../utils/context';
@@ -1,9 +1,9 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useContext } from 'react';
3
- import { View, StyleSheet, Linking,I18nManager } from 'react-native';
4
- import { StoryText, Text } from '@quintype/native-components/src/components';
1
+ import { Text } from '@quintype/native-components/src/components';
5
2
  import { textAnswerStyles } from '@quintype/native-components/src/components/TextA/styles';
6
3
  import { AppTheme } from '@quintype/native-components/src/utils/context';
4
+ import PropTypes from 'prop-types';
5
+ import React, { useContext } from 'react';
6
+ import { I18nManager, Linking, StyleSheet, View } from 'react-native';
7
7
  import HTML from 'react-native-render-html';
8
8
  import { customHTMLStyles } from '../../constants/renderHTML';
9
9
 
@@ -1,12 +1,12 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { View, Linking, StyleSheet } from 'react-native';
3
+ import { StyleSheet, View } from 'react-native';
4
4
  import HTML from 'react-native-render-html';
5
- import { Text } from '../index';
6
- import { bigTextStyles } from './styles';
7
- import { AppTheme } from '../../utils/context';
8
5
  import { customHTMLStyles } from '../../constants/renderHTML';
9
6
  import { alterQuoteData } from '../../utils';
7
+ import { AppTheme } from '../../utils/context';
8
+ import { Text } from '../index';
9
+ import { bigTextStyles } from './styles';
10
10
 
11
11
  export const TextBigFact = ({ text, attribution, id }) => {
12
12
  const { theme, useDeeplinkHandler } = useContext(AppTheme);
@@ -1,13 +1,13 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { View, Linking, StyleSheet } from 'react-native';
4
- import Icon from 'react-native-vector-icons/FontAwesome';
3
+ import { StyleSheet, View } from 'react-native';
5
4
  import HTML from 'react-native-render-html';
6
- import { Text } from '../index';
5
+ import Icon from 'react-native-vector-icons/FontAwesome';
7
6
  import { customHTMLStyles } from '../../constants/renderHTML';
8
- import { blockQuoteTextStyles } from './styles';
9
- import { AppTheme } from '../../utils/context';
10
7
  import { alterQuoteData } from '../../utils';
8
+ import { AppTheme } from '../../utils/context';
9
+ import { Text } from '../index';
10
+ import { blockQuoteTextStyles } from './styles';
11
11
 
12
12
  export const TextBlockQuote = ({ text, attribution }) => {
13
13
  const { theme, useDeeplinkHandler } = useContext(AppTheme);
@@ -1,10 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { View, Linking, StyleSheet } from 'react-native';
3
+ import { StyleSheet, View } from 'react-native';
4
4
  import HTML from 'react-native-render-html';
5
- import { textBlurbStyles } from './styles';
6
- import { AppTheme } from '../../utils/context';
7
5
  import { customHTMLStyles } from '../../constants/renderHTML';
6
+ import { AppTheme } from '../../utils/context';
7
+ import { textBlurbStyles } from './styles';
8
8
 
9
9
  export const TextBlurb = ({ text }) => {
10
10
  const { theme, useDeeplinkHandler } = useContext(AppTheme);
@@ -1,11 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import { View } from 'react-native';
4
- import { Text } from '../index';
5
- import { textQandAStyles } from './styles';
6
4
  import { AppTheme } from '../../utils/context';
7
- import { TextQ } from '../TextQ/index';
8
5
  import { TextA } from '../TextA/index';
6
+ import { TextQ } from '../TextQ/index';
7
+ import { textQandAStyles } from './styles';
9
8
 
10
9
  export const TextQandA = ({ question, answer }) => {
11
10
  const { theme } = useContext(AppTheme);
@@ -3,21 +3,17 @@ export { AuthorRow } from './AuthorRow';
3
3
  export { BackNavigator } from './BackNavigator';
4
4
  export { Button } from './Button';
5
5
  export { CollectionCard } from './CollectionCard';
6
- export { CollectionCardNew } from './CollectionCardNew';
7
6
  export { CollectionTitle } from './CollectionTitle';
8
- export { CollectionTitleNew } from './CollectionTitleNew';
9
7
  export { CustomLoader } from './CustomLoader';
10
8
  export { FBCommentsRow } from './FBCommentsRow';
11
9
  export { Header } from './Header';
12
10
  export { JSEmbedElement } from './JSEmbedElement';
13
11
  export { PDFReader } from './PDFReader';
14
12
  export { PrimaryStoryCard } from './PrimaryStoryCard';
15
- export { PrimaryStoryCardNew } from './PrimaryStoryCardNew';
16
13
  export { RadioButton } from './RadioButton';
17
14
  export { ResponsiveImage } from './ResponsiveImage';
18
15
  export { Search } from './Search';
19
16
  export { SecondaryStoryCard } from './SecondaryStoryCard';
20
- export { SecondaryStoryCardNew } from './SecondaryStoryCardNew';
21
17
  export { ShareButton } from './ShareButton';
22
18
  export { Story } from './Story';
23
19
  export { StoryContent } from './StoryContent';
@@ -1,84 +0,0 @@
1
- import get from 'lodash/get';
2
- import isEmpty from 'lodash/isEmpty';
3
- import PropTypes from 'prop-types';
4
- import React, { memo } from 'react';
5
- import { getScreenPercentageWidth } from '../../utils/index';
6
- import {
7
- CollectionTitleNew,
8
- PrimaryStoryCardNew,
9
- SecondaryStoryCardNew,
10
- ShareButton,
11
- } from '../index';
12
-
13
- const CollectionCardNewBase = ({
14
- cdn,
15
- collectionName,
16
- stories,
17
- onCollectionPress,
18
- onStoryPress,
19
- collectionTestID,
20
- offset,
21
- horizontalPadding,
22
- initialOffset, /* Number of items to load on first load */
23
- hideCollectionTitle,
24
- }) => {
25
- const sliceLimit = offset || initialOffset || 5;
26
- const primaryStory = !isEmpty(stories) && get(stories, [0, 'story'], stories[0]);
27
-
28
- return (
29
- <>
30
- {!hideCollectionTitle && (
31
- <CollectionTitleNew
32
- title={collectionName}
33
- onPress={onCollectionPress}
34
- horizontalPadding={horizontalPadding}
35
- />
36
- )}
37
- <PrimaryStoryCardNew
38
- collectionTestID={collectionTestID}
39
- onPress={() => {
40
- !isEmpty(stories) && onStoryPress(primaryStory);
41
- }}
42
- cdn={cdn}
43
- story={!isEmpty(stories) ? primaryStory : {}}
44
- iconComponent={<ShareButton story={primaryStory} inListingStoryCard />}
45
- imageWidth={getScreenPercentageWidth(100) - 2 * horizontalPadding}
46
- horizontalPadding={horizontalPadding}
47
- />
48
- {stories.slice(1, sliceLimit).map((currentStory) => {
49
- const secondaryStory = get(currentStory, ['story'], currentStory);
50
- return (
51
- <SecondaryStoryCardNew
52
- collectionTestID={collectionTestID}
53
- onPress={() => onStoryPress(secondaryStory)}
54
- key={secondaryStory?.id}
55
- cdn={cdn}
56
- story={secondaryStory}
57
- iconComponent={<ShareButton story={secondaryStory} inListingStoryCard />}
58
- imageWidth={getScreenPercentageWidth(28)}
59
- horizontalPadding={horizontalPadding}
60
- />
61
- );
62
- })}
63
- </>
64
- );
65
- };
66
-
67
- CollectionCardNewBase.propTypes = {
68
- offset: PropTypes.number,
69
- initialOffset: PropTypes.number,
70
- cdn: PropTypes.string.isRequired,
71
- collectionName: PropTypes.string,
72
- stories: PropTypes.array.isRequired,
73
- onCollectionPress: PropTypes.func,
74
- onStoryPress: PropTypes.func,
75
- collectionTestID: PropTypes.string,
76
- horizontalPadding: PropTypes.number,
77
- hideCollectionTitle: PropTypes.bool,
78
- };
79
-
80
- CollectionCardNewBase.defaultProps = {
81
- horizontalPadding: 12,
82
- };
83
-
84
- export const CollectionCardNew = memo(CollectionCardNewBase);
@@ -1,12 +0,0 @@
1
- import 'react-native';
2
- import React from 'react';
3
- import renderer from 'react-test-renderer';
4
-
5
- import { CollectionTitle } from './index';
6
- import { mockContext } from '../../utils';
7
-
8
- test('renders correctly', () => {
9
- const component = mockContext(<CollectionTitle />);
10
- const tree = renderer.create(component).toJSON();
11
- expect(tree).toMatchSnapshot();
12
- });
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`renders correctly 1`] = `null`;