@quintype/native-components 2.20.32-beta.1 → 2.20.32-beta.3

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.
@@ -1,63 +0,0 @@
1
- export const storyStyles = (COLORS = {}, FONT_SIZE = {}) => ({
2
- container: {
3
- backgroundColor: COLORS.BRAND_WHITE,
4
- padding: 8,
5
- },
6
- contentContainer: {
7
- flexDirection: 'row',
8
- justifyContent: 'space-between',
9
- alignItems: 'center',
10
- },
11
- headlineAndTimestampContainer: {
12
- flexShrink: 1,
13
- flex: 1,
14
- },
15
- timestamp: {
16
- color: COLORS?.BRAND_BLACK,
17
- fontSize: FONT_SIZE.h5,
18
- lineHeight: FONT_SIZE.h5 * 1.5,
19
- opacity: 0.6,
20
- marginTop: 4,
21
- },
22
- headline: {
23
- fontSize: FONT_SIZE.title,
24
- lineHeight: FONT_SIZE.title * 1.6,
25
- color: COLORS.BRAND_BLACK,
26
- marginTop: 4,
27
- },
28
- icon: {
29
- marginLeft: 8,
30
- },
31
- storyTypeContainer: {
32
- position: 'absolute',
33
- bottom: 0,
34
- left: 0,
35
- },
36
- storyType: {
37
- backgroundColor: COLORS.MONO1,
38
- padding: 8,
39
- justifyContent: 'space-between',
40
- alignItems: 'space-between',
41
- flexDirection: 'row',
42
- },
43
- storyTypeText: {
44
- color: COLORS.MONO7,
45
- fontSize: FONT_SIZE.h5,
46
- },
47
- liveBlogText: {
48
- color: COLORS.MONO7,
49
- fontSize: FONT_SIZE.h4,
50
- marginLeft: 10,
51
- fontWeight: 'bold',
52
- },
53
- liveBlogIcon: {
54
- height: 15,
55
- width: 15,
56
- borderRadius: 50,
57
- backgroundColor: COLORS.BRAND_3,
58
- },
59
- premiumIcon: {
60
- marginTop: FONT_SIZE.h3 * 0.92,
61
- marginRight: 5,
62
- },
63
- });
@@ -1,50 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useContext } from 'react';
3
- import { View } from 'react-native';
4
- import { StarRatingDisplay } from 'react-native-star-rating-widget';
5
- import { Text } from '../Text';
6
- import { ratingStyles } from './styles';
7
- import { AppTheme } from '../../utils';
8
-
9
- export const RatingLayout = ({ reviewTitle, ratingValue, ratingLabel }) => {
10
- const { theme } = useContext(AppTheme);
11
- const {
12
- COLORS, FONT_FAMILY, FONT_SIZE,
13
- } = theme;
14
- const styles = ratingStyles(COLORS, FONT_SIZE, FONT_FAMILY);
15
-
16
- return (
17
- <View style={styles.container}>
18
- {reviewTitle && (
19
- <Text
20
- style={styles.reviewTitle}
21
- primary
22
- >
23
- {reviewTitle}
24
- </Text>
25
- )}
26
- {ratingValue && (
27
- <View style={styles.child}>
28
- <Text
29
- style={styles.ratingLabel}
30
- >
31
- {`${ratingLabel}/5`}
32
- </Text>
33
- <StarRatingDisplay
34
- rating={ratingValue}
35
- starSize={FONT_SIZE.title}
36
- color={COLORS.REVIEW_STAR_COLOR ?? '#F5A623'}
37
- style={styles.starContiner}
38
- starStyle={styles.starStyle}
39
- />
40
- </View>
41
- )}
42
- </View>
43
- );
44
- };
45
-
46
- RatingLayout.propTypes = {
47
- reviewTitle: PropTypes.string.isRequired,
48
- ratingValue: PropTypes.number.isRequired,
49
- ratingLabel: PropTypes.string.isRequired,
50
- };
@@ -1,21 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- export const ratingStyles = (COLORS, FONT_SIZE, FONT_FAMILY) => StyleSheet.create({
4
- container: { marginLeft: 10, marginTop: 10 },
5
- reviewTitle: {
6
- fontSize: FONT_SIZE.h2,
7
- lineHeight: 24,
8
- fontFamily: FONT_FAMILY.primary,
9
- color: COLORS.BRAND_BLACK,
10
- marginBottom: 7,
11
- },
12
- child: { display: 'flex', flexDirection: 'row', alignItems: 'center' },
13
- ratingLabel: {
14
- fontSize: FONT_SIZE.h2,
15
- lineHeight: 24,
16
- fontFamily: FONT_FAMILY.secondary,
17
- color: COLORS.BRAND_BLACK,
18
- },
19
- starContainer: { marginLeft: 10 },
20
- starStyle: { marginHorizontal: 0 },
21
- });
@@ -1,157 +0,0 @@
1
- import { get, isNull, throttle } from 'lodash';
2
- import PropTypes from 'prop-types';
3
- import React, { useContext, memo, useState, useEffect } 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
- getTimeForStoryCards,
17
- } from '../../utils';
18
- import { getStoryHeadline } from '../../utils/story';
19
- import { ResponsiveImage, Text } from '../index';
20
- import { storyStyles } from './styles';
21
- import {
22
- COMP_GENERAL_CONSTANTS,
23
- COMP_CONTENT_CONSTANTS,
24
- } from '../../constants/component-constants';
25
- import PremiumIcons from '../../Icons/PremiumIcons/index';
26
-
27
- const SecondaryStoryCardNewBase = (props) => {
28
- const { story = {} } = props;
29
- const { theme } = useContext(AppTheme);
30
- const {
31
- locale,
32
- DARK_MODE,
33
- COLORS,
34
- reverseTimeAdverbPosition,
35
- enableReadTimeOnStoryCards,
36
- DATE_TIME_FORMAT,
37
- premiumIcon,
38
- FONT_SIZE
39
- } = theme;
40
-
41
- const translate = get(theme, ['translate'], (word) => word);
42
- const styles = storyStyles(theme, DARK_MODE);
43
- const containerStyle = StyleSheet.flatten([
44
- styles.container,
45
- { paddingHorizontal: props.horizontalPadding },
46
- ]);
47
- const headlineStyle = StyleSheet.flatten([
48
- styles.headline,
49
- props.headlineStyle,
50
- ]);
51
- const timestampStyle = StyleSheet.flatten([
52
- styles.timestamp,
53
- props.timestampStyle,
54
- ]);
55
-
56
- const DATE_FORMAT = DATE_TIME_FORMAT.dateFormat;
57
- const readTime = enableReadTimeOnStoryCards && story['read-time']
58
- ? `${story['read-time']} ${translate('min read')} · `
59
- : '';
60
- const isPremiumStory = story['access'] === 'subscription';
61
-
62
- const throttledOnpress = throttle(props.onPress, 1000);
63
-
64
- const showIcon = (name) => (
65
- <View style={styles.storyType}>
66
- <Icon name={name} size={14} color={COLORS.MONO7} />
67
- </View>
68
- );
69
-
70
- const showLiveBlogIcon = () => (
71
- <View style={styles.storyType}>
72
- <View style={styles.liveBlogIcon} />
73
- <Text style={styles.liveBlogText}>LIVE</Text>
74
- </View>
75
- );
76
-
77
- const showStoryType = () => {
78
- switch (story['story-template']) {
79
- case 'text':
80
- return null;
81
- case 'photo':
82
- return showIcon('photo');
83
- case 'video':
84
- return showIcon('play');
85
- case 'live-blog':
86
- return showLiveBlogIcon();
87
- default:
88
- null;
89
- }
90
- };
91
-
92
- return (
93
- <TouchableOpacity
94
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
95
- onPress={throttledOnpress}
96
- activeOpacity={0.8}
97
- style={containerStyle}
98
- >
99
- <ResponsiveImage
100
- metaData={getImageMetadata(story)}
101
- slug={getImageSlug(story) || ''}
102
- cdn={props.cdn || ''}
103
- imageWidth={props.imageWidth}
104
- >
105
- <View style={styles.storyTypeContainer}>{showStoryType()}</View>
106
- </ResponsiveImage>
107
- <View style={styles.headlineAndTimestampBlockContainer}>
108
- <View style={{display:'flex', flexDirection:'row'}}>
109
- <Text
110
- primary
111
- numberOfLines={2}
112
- ellipsizeMode="tail"
113
- style={headlineStyle}
114
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryHeadline}
115
- >
116
- {isPremiumStory && premiumIcon !=='none' && <PremiumIcons style={styles.premiumIcon} name={premiumIcon} color={COLORS.primary} size={FONT_SIZE.h4} />}
117
- {isPremiumStory && premiumIcon !=='none' && ' '}
118
- {getStoryHeadline(story)?.trim()}
119
- </Text>
120
- </View>
121
- <Text
122
- style={timestampStyle}
123
- numberOfLines={2}
124
- // TODO: Add corrected testID here
125
- testID={COMP_CONTENT_CONSTANTS.publishedDate}
126
- >
127
- {readTime
128
- + getTimeForStoryCards(
129
- story['published-at'],
130
- DATE_FORMAT,
131
- locale,
132
- translate,
133
- reverseTimeAdverbPosition,
134
- )}
135
- </Text>
136
- </View>
137
- <View style={styles.icon}>{props.iconComponent}</View>
138
- </TouchableOpacity>
139
- );
140
- };
141
-
142
- SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
143
- cdn: PropTypes.string.isRequired,
144
- imageWidth: PropTypes.number,
145
- headlineStyle: TextStyle,
146
- timestampStyle: TextStyle,
147
- story: PropTypes.any.isRequired,
148
- iconComponent: PropTypes.element,
149
- horizontalPadding: PropTypes.number,
150
- };
151
-
152
- SecondaryStoryCardNewBase.defaultProps = {
153
- cdn: '',
154
- horizontalPadding: 12,
155
- };
156
-
157
- export const SecondaryStoryCardNew = memo(SecondaryStoryCardNewBase);
@@ -1,64 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- export const storyStyles = ({ COLORS, FONT_SIZE }) => StyleSheet.create({
4
- container: {
5
- flexDirection: 'row',
6
- backgroundColor: COLORS.BRAND_WHITE,
7
- padding: 8,
8
- alignItems: 'center',
9
- },
10
- headlineAndTimestampBlockContainer: {
11
- flexShrink: 1,
12
- flex: 1,
13
- justifyContent: 'space-between',
14
- paddingLeft: 12,
15
- },
16
- timestamp: {
17
- color: COLORS.BRAND_BLACK,
18
- fontSize: FONT_SIZE.h5,
19
- lineHeight: FONT_SIZE.h5 * 1.5,
20
- opacity: 0.6,
21
- marginTop: 4,
22
- },
23
- headline: {
24
- color: COLORS.BRAND_BLACK,
25
- flexWrap: 'wrap',
26
- fontSize: FONT_SIZE.h3,
27
- lineHeight: FONT_SIZE.h3 * 1.6,
28
- },
29
- icon: {
30
- marginLeft: 8,
31
- },
32
- storyTypeContainer: {
33
- position: 'absolute',
34
- backgroundColor: COLORS.MONO1,
35
- bottom: 0,
36
- left: 0,
37
- },
38
- storyType: {
39
- padding: 5,
40
- justifyContent: 'space-between',
41
- alignItems: 'center',
42
- flexDirection: 'row',
43
- },
44
- storyTypeText: {
45
- color: COLORS.MONO7,
46
- fontSize: FONT_SIZE.h5,
47
- },
48
- liveBlogText: {
49
- color: COLORS.MONO7,
50
- fontSize: FONT_SIZE.h5,
51
- marginLeft: 4,
52
- fontWeight: 'bold',
53
- },
54
- liveBlogIcon: {
55
- height: 12,
56
- width: 12,
57
- borderRadius: 50,
58
- backgroundColor: COLORS.BRAND_3,
59
- },
60
- premiumIcon: {
61
- marginTop: FONT_SIZE.h3 * 0.45,
62
- marginRight: 3,
63
- },
64
- });