@quintype/native-components 2.20.18 → 2.20.19
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/Icons/PremiumIcons/index.js +20 -0
- package/src/components/PrimaryStoryCardNew/index.js +9 -0
- package/src/components/PrimaryStoryCardNew/styles.js +4 -0
- package/src/components/SecondaryStoryCardNew/index.js +10 -3
- package/src/components/SecondaryStoryCardNew/styles.js +4 -0
- package/src/components/StoryHeader/index.js +4 -4
- package/src/components/StoryTitle/index.js +8 -1
- package/src/components/StoryTitle/styles.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.20.19](https://github.com/quintype/native-components/compare/v2.20.18...v2.20.19) (2023-12-29)
|
|
6
|
+
|
|
5
7
|
### [2.20.18](https://github.com/quintype/native-components/compare/v2.20.17...v2.20.18) (2023-12-06)
|
|
6
8
|
|
|
7
9
|
### [2.20.17](https://github.com/quintype/native-components/compare/v2.20.16...v2.20.17) (2023-11-16)
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { AppTheme } from "../../utils/context";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
|
|
6
|
+
const PremiumIcon = ({name, style, size, color}) => {
|
|
7
|
+
const { theme } = useContext(AppTheme);
|
|
8
|
+
const { COLORS } = theme;
|
|
9
|
+
color = color ?? COLORS.BRAND_1;
|
|
10
|
+
return <MaterialIcon name={name} style={style} size={size} color={color} />
|
|
11
|
+
}
|
|
12
|
+
PremiumIcon.propTypes = {
|
|
13
|
+
name: PropTypes.string.isRequired,
|
|
14
|
+
size: PropTypes.any.isRequired,
|
|
15
|
+
color: PropTypes.string,
|
|
16
|
+
style: PropTypes.any
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export default PremiumIcon;
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
COMP_GENERAL_CONSTANTS,
|
|
17
17
|
COMP_CONTENT_CONSTANTS,
|
|
18
18
|
} from '../../constants/component-constants';
|
|
19
|
+
import PremiumIcons from '../../Icons/PremiumIcons/index';
|
|
19
20
|
|
|
20
21
|
const PrimaryStoryCardNewBase = (props) => {
|
|
21
22
|
const { story = {} } = props;
|
|
@@ -28,6 +29,7 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
28
29
|
reverseTimeAdverbPosition,
|
|
29
30
|
enableReadTimeOnStoryCards,
|
|
30
31
|
DATE_TIME_FORMAT,
|
|
32
|
+
premiumIcon
|
|
31
33
|
} = theme || {};
|
|
32
34
|
|
|
33
35
|
const translate = get(theme, ['translate'], (word) => word);
|
|
@@ -50,6 +52,7 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
50
52
|
const readTime = enableReadTimeOnStoryCards && story['read-time']
|
|
51
53
|
? `${story['read-time']} ${translate('min read')} · `
|
|
52
54
|
: '';
|
|
55
|
+
const isPremiumStory = story['access'] === 'subscription';
|
|
53
56
|
|
|
54
57
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
55
58
|
|
|
@@ -97,6 +100,9 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
97
100
|
</ResponsiveImage>
|
|
98
101
|
<View style={styles.contentContainer}>
|
|
99
102
|
<View style={styles.headlineAndTimestampContainer}>
|
|
103
|
+
<View style={{display:'flex', flexDirection:'row'}}>
|
|
104
|
+
|
|
105
|
+
|
|
100
106
|
<Text
|
|
101
107
|
primary
|
|
102
108
|
numberOfLines={3}
|
|
@@ -104,8 +110,11 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
104
110
|
style={headlineStyle}
|
|
105
111
|
testID={COMP_GENERAL_CONSTANTS.primaryStoryHeadline}
|
|
106
112
|
>
|
|
113
|
+
{isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h2} /> }
|
|
114
|
+
{isPremiumStory && premiumIcon !=='none' && ' '}
|
|
107
115
|
{getStoryHeadline(story)}
|
|
108
116
|
</Text>
|
|
117
|
+
</View>
|
|
109
118
|
<Text
|
|
110
119
|
style={timestampStyle}
|
|
111
120
|
numberOfLines={2}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { get, throttle } from 'lodash';
|
|
1
|
+
import { get, isNull, throttle } from 'lodash';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useContext, memo } from 'react';
|
|
3
|
+
import React, { useContext, memo, useState, useEffect } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
StyleSheet,
|
|
6
6
|
TouchableOpacity,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
COMP_GENERAL_CONSTANTS,
|
|
23
23
|
COMP_CONTENT_CONSTANTS,
|
|
24
24
|
} from '../../constants/component-constants';
|
|
25
|
+
import PremiumIcons from '../../Icons/PremiumIcons/index';
|
|
25
26
|
|
|
26
27
|
const SecondaryStoryCardNewBase = (props) => {
|
|
27
28
|
const { story = {} } = props;
|
|
@@ -33,10 +34,11 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
33
34
|
reverseTimeAdverbPosition,
|
|
34
35
|
enableReadTimeOnStoryCards,
|
|
35
36
|
DATE_TIME_FORMAT,
|
|
37
|
+
premiumIcon,
|
|
38
|
+
FONT_SIZE
|
|
36
39
|
} = theme;
|
|
37
40
|
|
|
38
41
|
const translate = get(theme, ['translate'], (word) => word);
|
|
39
|
-
|
|
40
42
|
const styles = storyStyles(theme, DARK_MODE);
|
|
41
43
|
const containerStyle = StyleSheet.flatten([
|
|
42
44
|
styles.container,
|
|
@@ -55,6 +57,7 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
55
57
|
const readTime = enableReadTimeOnStoryCards && story['read-time']
|
|
56
58
|
? `${story['read-time']} ${translate('min read')} · `
|
|
57
59
|
: '';
|
|
60
|
+
const isPremiumStory = story['access'] === 'subscription';
|
|
58
61
|
|
|
59
62
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
60
63
|
|
|
@@ -102,6 +105,7 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
102
105
|
<View style={styles.storyTypeContainer}>{showStoryType()}</View>
|
|
103
106
|
</ResponsiveImage>
|
|
104
107
|
<View style={styles.headlineAndTimestampBlockContainer}>
|
|
108
|
+
<View style={{display:'flex', flexDirection:'row'}}>
|
|
105
109
|
<Text
|
|
106
110
|
primary
|
|
107
111
|
numberOfLines={2}
|
|
@@ -109,8 +113,11 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
109
113
|
style={headlineStyle}
|
|
110
114
|
testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
|
|
111
115
|
>
|
|
116
|
+
{isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h4} />}
|
|
117
|
+
{isPremiumStory && premiumIcon !=='none' && ' '}
|
|
112
118
|
{getStoryHeadline(story)?.trim()}
|
|
113
119
|
</Text>
|
|
120
|
+
</View>
|
|
114
121
|
<Text
|
|
115
122
|
style={timestampStyle}
|
|
116
123
|
numberOfLines={2}
|
|
@@ -18,7 +18,6 @@ import { storyHeaderStyles } from './styles';
|
|
|
18
18
|
import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
|
|
19
19
|
|
|
20
20
|
import { DailyMotionPlayer } from '../DailyMotionPlayer';
|
|
21
|
-
|
|
22
21
|
const getHeroImage = (cdn, story) => {
|
|
23
22
|
const imageSlug = story['hero-image-s3-key'];
|
|
24
23
|
if (!imageSlug) return null;
|
|
@@ -66,13 +65,14 @@ export const StoryHeader = (props) => {
|
|
|
66
65
|
const { theme } = useContext(AppTheme);
|
|
67
66
|
|
|
68
67
|
const {
|
|
69
|
-
COLORS, locale, FONT_FAMILY, DATE_TIME_FORMAT,
|
|
68
|
+
COLORS, locale, FONT_FAMILY, DATE_TIME_FORMAT, premiumIcon, FONT_SIZE
|
|
70
69
|
} = theme;
|
|
71
70
|
|
|
72
71
|
const DATE_FORMAT = `${DATE_TIME_FORMAT.dateFormat} ${DATE_TIME_FORMAT.timeFormat}`;
|
|
73
|
-
const styles = storyHeaderStyles(COLORS, FONT_FAMILY);
|
|
72
|
+
const styles = storyHeaderStyles(COLORS, FONT_FAMILY, FONT_SIZE);
|
|
74
73
|
const caption = story['hero-image-caption'];
|
|
75
74
|
const attribution = story['hero-image-attribution'];
|
|
75
|
+
const isPremiumStory = story['access'] === 'subscription';
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
const showAttribution = () => {
|
|
@@ -121,7 +121,7 @@ export const StoryHeader = (props) => {
|
|
|
121
121
|
{getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
|
|
122
122
|
</Text>
|
|
123
123
|
</View>
|
|
124
|
-
|
|
124
|
+
<StoryTitle title={story.headline} subTitle={story.subheadline} isPremiumStory={isPremiumStory}/>
|
|
125
125
|
<AuthorRow
|
|
126
126
|
authors={story.authors}
|
|
127
127
|
onPress={props.onAuthorPress}
|
|
@@ -5,10 +5,14 @@ import { Text } from '../index';
|
|
|
5
5
|
import { storyTitleStyles } from './styles';
|
|
6
6
|
import { AppTheme } from '../../utils';
|
|
7
7
|
import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
|
|
8
|
+
import PremiumIcons from '../../Icons/PremiumIcons/index';
|
|
8
9
|
|
|
9
|
-
export const StoryTitle = ({ title, subTitle }) => {
|
|
10
|
+
export const StoryTitle = ({ title, subTitle, isPremiumStory }) => {
|
|
10
11
|
const { theme } = useContext(AppTheme);
|
|
11
12
|
const styles = storyTitleStyles(theme);
|
|
13
|
+
const {
|
|
14
|
+
premiumIcon, COLORS, FONT_SIZE
|
|
15
|
+
} = theme;
|
|
12
16
|
return (
|
|
13
17
|
<View style={styles.container}>
|
|
14
18
|
<Text
|
|
@@ -16,8 +20,11 @@ export const StoryTitle = ({ title, subTitle }) => {
|
|
|
16
20
|
style={styles.titleStyle}
|
|
17
21
|
testID={COMP_CONTENT_CONSTANTS.storyTitle}
|
|
18
22
|
>
|
|
23
|
+
{isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} size={FONT_SIZE.h2} name={premiumIcon} color={COLORS.primary} />}
|
|
24
|
+
{isPremiumStory && premiumIcon !=='none' && ' '}
|
|
19
25
|
{title?.trim() || ''}
|
|
20
26
|
</Text>
|
|
27
|
+
|
|
21
28
|
{subTitle && (
|
|
22
29
|
<Text
|
|
23
30
|
style={styles.subTitleStyle}
|