@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,140 +0,0 @@
1
- import { get, isNull, throttle } from 'lodash';
2
- import PropTypes from 'prop-types';
3
- import React, { useContext, memo } from 'react';
4
- import {
5
- StyleSheet,
6
- TouchableOpacity,
7
- View,
8
- TextStyle,
9
- TouchableOpacityProps,
10
- } from 'react-native';
11
- import Icon from 'react-native-vector-icons/FontAwesome';
12
- import {
13
- AppTheme,
14
- getImageMetadata,
15
- getImageSlug,
16
- } from '../../utils';
17
- import { getStoryHeadline } from '../../utils/story';
18
- import { ResponsiveImage, Text, StoryCardDetailsRow } from '../index';
19
- import { storyStyles } from './styles';
20
- import {
21
- COMP_GENERAL_CONSTANTS,
22
- COMP_CONTENT_CONSTANTS,
23
- } from '../../constants/component-constants';
24
- import PremiumIcons from '../../Icons/PremiumIcons/index';
25
-
26
- const SecondaryStoryCardNewBase = (props) => {
27
- const { story = {} } = props;
28
- const { theme } = useContext(AppTheme);
29
- const {
30
- COLORS,
31
- premiumIcon,
32
- FONT_SIZE,
33
- storyCardOptions = {},
34
- } = theme;
35
-
36
- const styles = storyStyles(theme);
37
- const containerStyle = StyleSheet.flatten([
38
- styles.container,
39
- { paddingHorizontal: props.horizontalPadding },
40
- ]);
41
- const headlineStyle = StyleSheet.flatten([
42
- styles.headline,
43
- props.headlineStyle,
44
- ]);
45
-
46
- const isPremiumStory = story['access'] === 'subscription';
47
-
48
- const throttledOnpress = throttle(props.onPress, 1000);
49
-
50
- const showIcon = (name) => (
51
- <View style={styles.storyType}>
52
- <Icon name={name} size={14} color={COLORS.MONO7} />
53
- </View>
54
- );
55
-
56
- const showLiveBlogIcon = () => (
57
- <View style={styles.storyType}>
58
- <View style={styles.liveBlogIcon} />
59
- <Text style={styles.liveBlogText}>LIVE</Text>
60
- </View>
61
- );
62
-
63
- const showStoryType = () => {
64
- switch (story['story-template']) {
65
- case 'text':
66
- return null;
67
- case 'photo':
68
- return showIcon('photo');
69
- case 'video':
70
- return showIcon('play');
71
- case 'live-blog':
72
- return showLiveBlogIcon();
73
- default:
74
- null;
75
- }
76
- };
77
-
78
- return (
79
- <>
80
- <TouchableOpacity
81
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
82
- onPress={throttledOnpress}
83
- activeOpacity={0.8}
84
- style={containerStyle}
85
- >
86
- <View style={[styles.imageAndDetails, storyCardOptions.alignSmallCardImage === "right" && { flexDirection: 'row-reverse'}]}>
87
- {storyCardOptions.enableSmallCardImage && (<ResponsiveImage
88
- styles={styles.image}
89
- metaData={getImageMetadata(story)}
90
- slug={getImageSlug(story) || ''}
91
- cdn={props.cdn || ''}
92
- imageWidth={props.imageWidth}
93
- >
94
- <View style={styles.storyTypeContainer}>{showStoryType()}</View>
95
- </ResponsiveImage>)
96
- }
97
- <View style={styles.headlineAndTimestampBlockContainer}>
98
- {storyCardOptions.enableSectionName && <Text numberOfLines={1} ellipsizeMode="tail" style={styles.sectionName}>{get(story, ['sections', 0, 'display-name'], '')}</Text>}
99
- <View style={{display:'flex', flexDirection:'row'}}>
100
- <Text
101
- primary
102
- numberOfLines={storyCardOptions.numberOfLinesForTitle}
103
- ellipsizeMode="tail"
104
- style={headlineStyle}
105
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
106
- >
107
- {isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h4} />}
108
- {isPremiumStory && premiumIcon !=='none' && ' '}
109
- {getStoryHeadline(story)?.trim()}
110
- </Text>
111
- </View>
112
- <StoryCardDetailsRow
113
- authorName={get(story.authors, [0, 'name'])}
114
- publishedAt={story["published-at"]}
115
- readTime={story['read-time']}
116
- />
117
- </View>
118
- </View>
119
- <View style={styles.icon}>{props.iconComponent}</View>
120
- </TouchableOpacity>
121
- <View style={[styles.separatorLine, { marginHorizontal: props.horizontalPadding }]}/>
122
- </>
123
- );
124
- };
125
-
126
- SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
127
- cdn: PropTypes.string.isRequired,
128
- imageWidth: PropTypes.number,
129
- headlineStyle: TextStyle,
130
- story: PropTypes.any.isRequired,
131
- iconComponent: PropTypes.element,
132
- horizontalPadding: PropTypes.number,
133
- };
134
-
135
- SecondaryStoryCardNewBase.defaultProps = {
136
- cdn: '',
137
- horizontalPadding: 12,
138
- };
139
-
140
- export const SecondaryStoryCardNew = memo(SecondaryStoryCardNewBase);
@@ -1,82 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- export const storyStyles = ({ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {} }) => StyleSheet.create({
4
- container: {
5
- flexDirection: 'row',
6
- justifyContent: 'space-between',
7
- backgroundColor: COLORS.BRAND_WHITE,
8
- paddingVertical: 10,
9
- alignItems: 'flex-start',
10
- gap: 10,
11
- },
12
- imageAndDetails: {
13
- flexDirection: 'row',
14
- flexShrink: 1,
15
- alignItems: 'flex-start',
16
- gap: 10,
17
- },
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,
30
- justifyContent: 'space-between',
31
- },
32
- sectionName: {
33
- color: COLORS.BRAND_1,
34
- fontSize: FONT_SIZE.h4,
35
- lineHeight: FONT_SIZE.h4 * lineHeightMultiplier,
36
- },
37
- headline: {
38
- color: COLORS.BRAND_BLACK,
39
- flexWrap: 'wrap',
40
- fontSize: FONT_SIZE.h3,
41
- fontFamily: FONT_FAMILY.primaryBold,
42
- lineHeight: FONT_SIZE.h3 * lineHeightMultiplier,
43
- marginBottom: 4,
44
- },
45
- storyTypeContainer: {
46
- position: 'absolute',
47
- backgroundColor: COLORS.MONO1,
48
- bottom: 0,
49
- left: 0,
50
- },
51
- storyType: {
52
- padding: 5,
53
- justifyContent: 'space-between',
54
- alignItems: 'center',
55
- flexDirection: 'row',
56
- },
57
- storyTypeText: {
58
- color: COLORS.MONO7,
59
- fontSize: FONT_SIZE.h5,
60
- },
61
- liveBlogText: {
62
- color: COLORS.MONO7,
63
- fontSize: FONT_SIZE.h5,
64
- marginLeft: 4,
65
- fontWeight: 'bold',
66
- },
67
- liveBlogIcon: {
68
- height: 12,
69
- width: 12,
70
- borderRadius: 50,
71
- backgroundColor: COLORS.BRAND_3,
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
- },
82
- });