@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,66 +1,47 @@
|
|
|
1
|
-
export const storyStyles = (COLORS
|
|
1
|
+
export const storyStyles = ({COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {}}) => ({
|
|
2
2
|
container: {
|
|
3
3
|
backgroundColor: COLORS.BRAND_WHITE,
|
|
4
|
-
|
|
4
|
+
paddingVertical: 10,
|
|
5
|
+
gap: 10,
|
|
5
6
|
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
color: COLORS.BRAND_BLACK,
|
|
22
|
-
opacity: 0.9,
|
|
13
|
+
headlineAndTimestampContainer: {
|
|
14
|
+
flexShrink: 1,
|
|
15
|
+
gap: 4,
|
|
23
16
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
right: 8,
|
|
17
|
+
icon: {
|
|
18
|
+
marginBottom: 4,
|
|
19
|
+
marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
|
|
28
20
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
sectionName: {
|
|
22
|
+
color: COLORS.BRAND_1,
|
|
23
|
+
fontSize: FONT_SIZE.h4,
|
|
24
|
+
lineHeight: FONT_SIZE.h4 * lineHeightMultiplier,
|
|
33
25
|
},
|
|
34
|
-
|
|
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
|
-
|
|
31
|
+
marginBottom: 4,
|
|
37
32
|
},
|
|
38
33
|
storyTypeContainer: {
|
|
39
34
|
position: 'absolute',
|
|
40
35
|
bottom: 0,
|
|
41
36
|
left: 0,
|
|
42
37
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
61
|
-
height:
|
|
62
|
-
|
|
63
|
-
|
|
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,
|
|
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
|
-
|
|
45
|
-
<SecondaryStoryCardNew
|
|
42
|
+
return <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
|
};
|
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React, {
|
|
3
3
|
memo, useCallback, useContext, useState,
|
|
4
4
|
} from 'react';
|
|
5
|
-
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { StyleSheet, View, ImageBackground } from 'react-native';
|
|
6
6
|
import FastImage from 'react-native-fast-image';
|
|
7
7
|
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
8
8
|
import { FallbackIcon } from '../../Icons/FallBackIcon';
|
|
@@ -23,6 +23,14 @@ const ResponsiveImageBase = (props) => {
|
|
|
23
23
|
roundedImageCorners,
|
|
24
24
|
} = theme;
|
|
25
25
|
|
|
26
|
+
const flattenedBackgroudStyle = StyleSheet.flatten([
|
|
27
|
+
{marginTop: props.styles?.marginTop ?? 0},
|
|
28
|
+
roundedImageCorners && {
|
|
29
|
+
borderRadius: 12,
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
},
|
|
32
|
+
])
|
|
33
|
+
|
|
26
34
|
const flattenedImageStyle = StyleSheet.flatten([
|
|
27
35
|
styles.defaultImage,
|
|
28
36
|
props.styles,
|
|
@@ -30,15 +38,11 @@ const ResponsiveImageBase = (props) => {
|
|
|
30
38
|
width: props.imageWidth,
|
|
31
39
|
height: (props.imageWidth * 9) / 16,
|
|
32
40
|
},
|
|
33
|
-
props?.
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
roundedImageCorners && {
|
|
37
|
-
borderRadius: 12,
|
|
38
|
-
overflow: "hidden",
|
|
39
|
-
},
|
|
41
|
+
props.styles?.marginTop && { marginTop: 0 } ,
|
|
42
|
+
|
|
40
43
|
]);
|
|
41
44
|
|
|
45
|
+
|
|
42
46
|
const placeholderStyle = {
|
|
43
47
|
...StyleSheet.absoluteFillObject,
|
|
44
48
|
...props.styles,
|
|
@@ -47,6 +51,7 @@ const ResponsiveImageBase = (props) => {
|
|
|
47
51
|
justifyContent: "center",
|
|
48
52
|
alignItems: "center",
|
|
49
53
|
borderRadius: roundedImageCorners ? 12 : 0,
|
|
54
|
+
marginTop: 0
|
|
50
55
|
};
|
|
51
56
|
|
|
52
57
|
const fallBackIcon = CustomFallBackIcon ? (
|
|
@@ -55,13 +60,8 @@ const ResponsiveImageBase = (props) => {
|
|
|
55
60
|
<FallbackIcon />
|
|
56
61
|
);
|
|
57
62
|
|
|
58
|
-
let imageUrl = '';
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
imageUrl = getCustomResolutionImageURL(props, [1, 1]);
|
|
62
|
-
} else {
|
|
63
|
-
imageUrl = getImageURL(props);
|
|
64
|
-
}
|
|
64
|
+
let imageUrl = getImageURL(props)
|
|
65
65
|
|
|
66
66
|
const userFallback = () => <Icon name="user" size={20} />;
|
|
67
67
|
|
|
@@ -77,6 +77,11 @@ const ResponsiveImageBase = (props) => {
|
|
|
77
77
|
|
|
78
78
|
const onLoadHandler = useCallback(handleImageLoad, []);
|
|
79
79
|
|
|
80
|
+
const lowestQualitySourceURI = {
|
|
81
|
+
uri: decodeURIComponent(getImageURL(props,2)),
|
|
82
|
+
priority: FastImage.priority.high,
|
|
83
|
+
}
|
|
84
|
+
|
|
80
85
|
const sourceURI = {
|
|
81
86
|
uri: decodeURIComponent(imageUrl),
|
|
82
87
|
priority: FastImage.priority.high,
|
|
@@ -85,15 +90,27 @@ const ResponsiveImageBase = (props) => {
|
|
|
85
90
|
|
|
86
91
|
const preferredResizeMode = resizeImagesToFit ? FastImage.resizeMode.contain : FastImage.resizeMode.cover;
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
const ImageLayout = () => {
|
|
94
|
+
return (
|
|
90
95
|
<FastImage
|
|
91
96
|
style={flattenedImageStyle}
|
|
92
97
|
source={sourceURI}
|
|
93
|
-
|
|
94
|
-
resizeMode={props?.elementType === 'gallery' && !(props.hero) ? FastImage.resizeMode.contain : preferredResizeMode}
|
|
98
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
95
99
|
{...props}
|
|
96
100
|
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<View style={flattenedBackgroudStyle}>
|
|
106
|
+
<ImageBackground
|
|
107
|
+
source={lowestQualitySourceURI}
|
|
108
|
+
resizeMode='cover'
|
|
109
|
+
blurRadius={50}
|
|
110
|
+
onLoad={()=>setPlaceholder(false)}
|
|
111
|
+
>
|
|
112
|
+
<ImageLayout />
|
|
113
|
+
</ImageBackground>
|
|
97
114
|
{placeholder && (
|
|
98
115
|
<View style={placeholderStyle} testID={props.containerTestID}>
|
|
99
116
|
{showFallBackIcon()}
|
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
<
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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:
|
|
8
|
+
paddingVertical: 10,
|
|
9
|
+
alignItems: 'flex-start',
|
|
10
|
+
gap: 10,
|
|
8
11
|
},
|
|
9
|
-
|
|
12
|
+
imageAndDetails: {
|
|
13
|
+
flexDirection: 'row',
|
|
10
14
|
flexShrink: 1,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
paddingHorizontal: 10,
|
|
15
|
+
alignItems: 'flex-start',
|
|
16
|
+
gap: 10,
|
|
14
17
|
},
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
color: COLORS.
|
|
21
|
-
fontSize: FONT_SIZE.
|
|
22
|
-
lineHeight: FONT_SIZE.
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
74
|
-
height:
|
|
75
|
-
|
|
76
|
-
|
|
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, {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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 {
|
|
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}`;
|
|
@@ -138,7 +138,7 @@ export const StoryGallery = ({ cdn, card }) => {
|
|
|
138
138
|
|
|
139
139
|
const style = galleryStyles.fullWidth;
|
|
140
140
|
return (
|
|
141
|
-
<TouchableOpacity>
|
|
141
|
+
<TouchableOpacity style={galleryStyles.subContainer}>
|
|
142
142
|
<LightBoxImage
|
|
143
143
|
onClickHandler={onPressHandler}
|
|
144
144
|
hero={!!data.metaData['focus-point']}
|