@quintype/native-components 2.28.0 → 2.28.2
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.
- package/bin-dev-scripts/standard-version-release.sh +11 -11
- package/package.json +1 -1
- package/src/components/AlsoRead/index.js +4 -4
- package/src/components/AuthorRow/index.js +3 -3
- package/src/components/BackNavigator/index.js +6 -6
- package/src/components/Button/index.js +1 -1
- package/src/components/CollectionCard/index.js +20 -10
- package/src/components/CollectionTitle/index.js +20 -38
- package/src/components/CollectionTitle/styles.js +11 -13
- package/src/components/CustomSwitch/index.js +4 -4
- package/src/components/DailyMotionPlayer/index.js +2 -2
- package/src/components/Header/index.js +2 -2
- package/src/components/Html/index.js +4 -4
- package/src/components/IconText/index.js +4 -4
- package/src/components/JSEmbedElement/index.js +3 -3
- package/src/components/LightBoxImage/index.js +2 -2
- package/src/components/PDFReader/index.js +7 -8
- package/src/components/PDFReader/styles.js +1 -0
- package/src/components/PrimaryStoryCard/index.js +47 -92
- package/src/components/PrimaryStoryCard/styles.js +30 -49
- package/src/components/RadioButton/index.js +3 -3
- package/src/components/Rating/index.js +1 -1
- package/src/components/RelatedStoriesCard/index.js +2 -12
- package/src/components/ResponsiveImage/index.js +35 -18
- package/src/components/SecondaryStoryCard/index.js +59 -108
- package/src/components/SecondaryStoryCard/styles.js +35 -55
- package/src/components/ShareButton/index.js +1 -1
- package/src/components/Story/index.js +12 -13
- package/src/components/StoryGallery/index.js +1 -1
- package/src/components/StoryGallery/styles.js +3 -0
- package/src/components/StoryHeader/index.js +8 -8
- package/src/components/StoryTemplateIcon/index.js +1 -1
- package/src/components/StoryTemplateIcon/styles.js +1 -1
- package/src/components/StoryText/index.js +5 -2
- package/src/components/TextA/index.js +4 -4
- package/src/components/TextBigFact/index.js +4 -4
- package/src/components/TextBlockQuote/index.js +5 -5
- package/src/components/TextBlurb/index.js +3 -3
- package/src/components/TextQandA/index.js +2 -3
- package/src/components/index.js +1 -5
- package/src/components/CollectionCardNew/index.js +0 -84
- package/src/components/CollectionTitle/CollectionTitle.test.js +0 -12
- package/src/components/CollectionTitle/__snapshots__/CollectionTitle.test.js.snap +0 -3
- package/src/components/CollectionTitleNew/index.js +0 -44
- package/src/components/CollectionTitleNew/styles.js +0 -20
- package/src/components/PrimaryStoryCard/PrimaryStoryCard.test.js +0 -43
- package/src/components/PrimaryStoryCardNew/index.js +0 -106
- package/src/components/PrimaryStoryCardNew/styles.js +0 -47
- package/src/components/SecondaryStoryCard/SecondaryStoryCard.test.js +0 -51
- package/src/components/SecondaryStoryCardNew/index.js +0 -113
- package/src/components/SecondaryStoryCardNew/styles.js +0 -59
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { get, 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 {
|
|
12
|
-
AppTheme,
|
|
13
|
-
getImageMetadata,
|
|
14
|
-
getImageSlug,
|
|
15
|
-
} from '../../utils';
|
|
16
|
-
import { getStoryHeadline } from '../../utils/story';
|
|
17
|
-
import { ResponsiveImage, Text, StoryCardDetailsRow, StoryTemplateIcon } from '../index';
|
|
18
|
-
import { storyStyles } from './styles';
|
|
19
|
-
import {
|
|
20
|
-
COMP_GENERAL_CONSTANTS,
|
|
21
|
-
COMP_CONTENT_CONSTANTS,
|
|
22
|
-
} from '../../constants/component-constants';
|
|
23
|
-
import PremiumIcons from '../../Icons/PremiumIcons/index';
|
|
24
|
-
|
|
25
|
-
const SecondaryStoryCardNewBase = (props) => {
|
|
26
|
-
const { story = {} } = props;
|
|
27
|
-
const { theme } = useContext(AppTheme);
|
|
28
|
-
const {
|
|
29
|
-
COLORS,
|
|
30
|
-
premiumIcon,
|
|
31
|
-
FONT_SIZE,
|
|
32
|
-
storyCardOptions = {},
|
|
33
|
-
} = theme;
|
|
34
|
-
|
|
35
|
-
const styles = storyStyles(theme);
|
|
36
|
-
const containerStyle = StyleSheet.flatten([
|
|
37
|
-
styles.container,
|
|
38
|
-
{ paddingHorizontal: props.horizontalPadding },
|
|
39
|
-
]);
|
|
40
|
-
const headlineStyle = StyleSheet.flatten([
|
|
41
|
-
styles.headline,
|
|
42
|
-
props.headlineStyle,
|
|
43
|
-
]);
|
|
44
|
-
|
|
45
|
-
const isPremiumStory = story['access'] === 'subscription';
|
|
46
|
-
|
|
47
|
-
const throttledOnpress = throttle(props.onPress, 1000);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<TouchableOpacity
|
|
52
|
-
testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
|
|
53
|
-
onPress={throttledOnpress}
|
|
54
|
-
activeOpacity={0.8}
|
|
55
|
-
style={containerStyle}
|
|
56
|
-
>
|
|
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}
|
|
64
|
-
>
|
|
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>
|
|
91
|
-
</View>
|
|
92
|
-
<View style={styles.icon}>{props.iconComponent}</View>
|
|
93
|
-
</TouchableOpacity>
|
|
94
|
-
<View style={[styles.separatorLine, { marginHorizontal: props.horizontalPadding }]} />
|
|
95
|
-
</>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
|
|
100
|
-
cdn: PropTypes.string.isRequired,
|
|
101
|
-
imageWidth: PropTypes.number,
|
|
102
|
-
headlineStyle: TextStyle,
|
|
103
|
-
story: PropTypes.any.isRequired,
|
|
104
|
-
iconComponent: PropTypes.element,
|
|
105
|
-
horizontalPadding: PropTypes.number,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
SecondaryStoryCardNewBase.defaultProps = {
|
|
109
|
-
cdn: '',
|
|
110
|
-
horizontalPadding: 12,
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const SecondaryStoryCardNew = memo(SecondaryStoryCardNewBase);
|
|
@@ -1,59 +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
|
-
bottom: 0,
|
|
48
|
-
left: 0,
|
|
49
|
-
},
|
|
50
|
-
premiumIcon: {
|
|
51
|
-
marginTop: FONT_SIZE.h3 * 0.45,
|
|
52
|
-
marginRight: 3,
|
|
53
|
-
},
|
|
54
|
-
separatorLine: {
|
|
55
|
-
height: 0.8,
|
|
56
|
-
opacity: 0.1,
|
|
57
|
-
backgroundColor: COLORS.BRAND_BLACK,
|
|
58
|
-
},
|
|
59
|
-
});
|