@quintype/native-components 2.18.3 → 2.19.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/CHANGELOG.md +29 -0
- package/package.json +1 -1
- package/src/components/AlsoRead/index.js +2 -2
- package/src/components/AlsoRead/styles.js +2 -2
- package/src/components/CollectionCard/index.js +14 -2
- package/src/components/CollectionTitle/index.js +10 -1
- package/src/components/CollectionTitle/styles.js +3 -5
- package/src/components/PDFReader/index.js +2 -2
- package/src/components/PDFReader/styles.js +4 -3
- package/src/components/PrimaryStoryCard/index.js +7 -2
- package/src/components/PrimaryStoryCard/styles.js +4 -0
- package/src/components/ResponsiveImage/index.js +18 -16
- package/src/components/SecondaryStoryCard/index.js +11 -1
- package/src/components/SecondaryStoryCard/styles.js +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
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.19.2](https://github.com/quintype/native-components/compare/v2.19.1...v2.19.2) (2021-10-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **AlsoRead:** Changed dark-mode color for the text :hammer: ([#170](https://github.com/quintype/native-components/issues/170)) ([67f1e61](https://github.com/quintype/native-components/commit/67f1e61fd4b76ea6fa65f565006214981d0bb8a8))
|
|
11
|
+
|
|
12
|
+
### [2.19.1](https://github.com/quintype/native-components/compare/v2.19.0...v2.19.1) (2021-10-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **old-UI:** Fixes all padding/image-aspect-ratio inconsistencies 🔨 ([#169](https://github.com/quintype/native-components/issues/169)) ([f3b8850](https://github.com/quintype/native-components/commit/f3b88507c02985ff83aadd266e0dbd04438fd441))
|
|
18
|
+
|
|
19
|
+
## [2.19.0](https://github.com/quintype/native-components/compare/v2.17.3...v2.19.0) (2021-10-06)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **new-designs:** new components for listing-screens redesign and other improvements ([#164](https://github.com/quintype/native-components/issues/164)) ([67b6619](https://github.com/quintype/native-components/commit/67b6619c5062fe3b0d3ab8682912d2c8642a6549))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **app:** for multiple reg-april-week4 bugs 🔨 ([#162](https://github.com/quintype/native-components/issues/162)) ([4ac86fe](https://github.com/quintype/native-components/commit/4ac86fe9109440e7e1708fff153bb2c54afb003e))
|
|
30
|
+
* **headline:** Increasing lineHeight to fix clipping in Indian fonts :hammer: ([0bacd63](https://github.com/quintype/native-components/commit/0bacd63d7e61849b318b2d083524c6c8f09f3b09))
|
|
31
|
+
|
|
32
|
+
### [2.18.4](https://github.com/quintype/native-components/compare/v2.18.3...v2.18.4) (2021-10-05)
|
|
33
|
+
|
|
5
34
|
### [2.18.3](https://github.com/quintype/native-components/compare/v2.18.2...v2.18.3) (2021-10-04)
|
|
6
35
|
|
|
7
36
|
|
package/package.json
CHANGED
|
@@ -25,8 +25,8 @@ export const AlsoRead = (props) => {
|
|
|
25
25
|
const linkedImage = get(linkedStories, [linkedStoryId, 'hero-image-s3-key']);
|
|
26
26
|
|
|
27
27
|
const { theme } = useContext(AppTheme);
|
|
28
|
-
const { COLORS, FONT_SIZE, CustomFallBackIcon } = theme;
|
|
29
|
-
const styles = alsoReadStyles(COLORS, FONT_SIZE);
|
|
28
|
+
const { COLORS, FONT_SIZE, DARK_MODE, CustomFallBackIcon } = theme;
|
|
29
|
+
const styles = alsoReadStyles(COLORS, FONT_SIZE, DARK_MODE);
|
|
30
30
|
|
|
31
31
|
const fallBackIcon = CustomFallBackIcon ? <CustomFallBackIcon /> : <FallbackIcon />;
|
|
32
32
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export const alsoReadStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
3
|
+
export const alsoReadStyles = (COLORS, FONT_SIZE, DARK_MODE) => StyleSheet.create({
|
|
4
4
|
wrapper: {
|
|
5
5
|
padding: 10,
|
|
6
6
|
},
|
|
@@ -13,7 +13,7 @@ export const alsoReadStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
|
13
13
|
},
|
|
14
14
|
alsoReadText: {
|
|
15
15
|
fontSize: FONT_SIZE.h2,
|
|
16
|
-
color: COLORS.BRAND_1,
|
|
16
|
+
color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_1,
|
|
17
17
|
},
|
|
18
18
|
alsoReadTitle: {
|
|
19
19
|
fontSize: FONT_SIZE.h2,
|
|
@@ -16,20 +16,26 @@ export const CollectionCard = ({
|
|
|
16
16
|
onCollectionPress,
|
|
17
17
|
onStoryPress,
|
|
18
18
|
offset,
|
|
19
|
+
horizontalPadding,
|
|
19
20
|
initialOffset /* Number of items to load on first load */,
|
|
20
21
|
}) => {
|
|
21
22
|
const sliceLimit = offset || initialOffset || 5;
|
|
22
23
|
const primaryStory = !isEmpty(stories) && get(stories, [0, 'story'], stories[0]);
|
|
23
24
|
return (
|
|
24
25
|
<>
|
|
25
|
-
<CollectionTitle
|
|
26
|
+
<CollectionTitle
|
|
27
|
+
title={collectionName}
|
|
28
|
+
onPress={onCollectionPress}
|
|
29
|
+
horizontalPadding={horizontalPadding}
|
|
30
|
+
/>
|
|
26
31
|
<PrimaryStoryCard
|
|
27
32
|
onPress={() => {
|
|
28
33
|
!isEmpty(stories) && onStoryPress(primaryStory);
|
|
29
34
|
}}
|
|
30
35
|
cdn={cdn}
|
|
31
36
|
story={!isEmpty(stories) ? primaryStory : {}}
|
|
32
|
-
imageWidth={getScreenPercentageWidth(100)}
|
|
37
|
+
imageWidth={getScreenPercentageWidth(100) - 2 * horizontalPadding}
|
|
38
|
+
horizontalPadding={horizontalPadding}
|
|
33
39
|
/>
|
|
34
40
|
{stories.slice(1, sliceLimit).map((currentStory) => {
|
|
35
41
|
const secondaryStory = get(currentStory, ['story'], currentStory);
|
|
@@ -40,6 +46,7 @@ export const CollectionCard = ({
|
|
|
40
46
|
cdn={cdn}
|
|
41
47
|
story={secondaryStory}
|
|
42
48
|
imageWidth={getScreenPercentageWidth(40)}
|
|
49
|
+
horizontalPadding={horizontalPadding}
|
|
43
50
|
/>
|
|
44
51
|
);
|
|
45
52
|
})}
|
|
@@ -54,4 +61,9 @@ CollectionCard.propTypes = {
|
|
|
54
61
|
onCollectionPress: PropTypes.func,
|
|
55
62
|
onStoryPress: PropTypes.func,
|
|
56
63
|
offset: PropTypes.number,
|
|
64
|
+
horizontalPadding: PropTypes.number,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
CollectionCard.defaultProps = {
|
|
68
|
+
horizontalPadding: 12,
|
|
57
69
|
};
|
|
@@ -18,6 +18,10 @@ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/gene
|
|
|
18
18
|
export const CollectionTitle = (props) => {
|
|
19
19
|
const { theme } = useContext(AppTheme);
|
|
20
20
|
const styles = collectionStyles(theme);
|
|
21
|
+
const containerStyle = StyleSheet.flatten([
|
|
22
|
+
styles.titleContainer,
|
|
23
|
+
{ paddingHorizontal: props.horizontalPadding },
|
|
24
|
+
]);
|
|
21
25
|
const titleStyle = StyleSheet.flatten([styles.titleStyle, props.titleStyle]);
|
|
22
26
|
const indicatorStyle = StyleSheet.flatten([
|
|
23
27
|
styles.indicatorStyle,
|
|
@@ -30,7 +34,7 @@ export const CollectionTitle = (props) => {
|
|
|
30
34
|
|
|
31
35
|
return (
|
|
32
36
|
<TouchableOpacity
|
|
33
|
-
style={
|
|
37
|
+
style={containerStyle}
|
|
34
38
|
onPress={props.onPress}
|
|
35
39
|
testID={COMP_GENERAL_CONSTANTS.collectionTitleTouch}
|
|
36
40
|
>
|
|
@@ -49,4 +53,9 @@ CollectionTitle.propTypes = TouchableOpacityProps && {
|
|
|
49
53
|
title: PropTypes.string,
|
|
50
54
|
titleStyle: TextStyle,
|
|
51
55
|
indicatorStyle: ViewStyle,
|
|
56
|
+
horizontalPadding: PropTypes.number,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
CollectionTitle.defaultProps = {
|
|
60
|
+
horizontalPadding: 12,
|
|
52
61
|
};
|
|
@@ -4,18 +4,16 @@ export const collectionStyles = (appThemeContext) => {
|
|
|
4
4
|
const { COLORS, FONT_SIZE } = appThemeContext;
|
|
5
5
|
return StyleSheet.create({
|
|
6
6
|
titleContainer: {
|
|
7
|
-
|
|
7
|
+
backgroundColor: COLORS.BRAND_WHITE,
|
|
8
|
+
paddingVertical: 12,
|
|
8
9
|
justifyContent: 'center',
|
|
9
|
-
marginBottom: 10,
|
|
10
10
|
},
|
|
11
11
|
titleStyle: {
|
|
12
12
|
fontSize: FONT_SIZE.h1,
|
|
13
13
|
color: COLORS.BRAND_5,
|
|
14
14
|
},
|
|
15
15
|
indicatorStyle: {
|
|
16
|
-
|
|
17
|
-
left: 0,
|
|
18
|
-
bottom: 0,
|
|
16
|
+
marginTop: 8,
|
|
19
17
|
width: 30,
|
|
20
18
|
height: 3,
|
|
21
19
|
backgroundColor: COLORS.BRAND_1,
|
|
@@ -20,7 +20,7 @@ export const PDFReader = ({ card, share }) => {
|
|
|
20
20
|
const [modalVisible, setModalVisible] = useState(false);
|
|
21
21
|
|
|
22
22
|
const { theme } = useContext(AppTheme);
|
|
23
|
-
const { COLORS, FONT_SIZE } = theme;
|
|
23
|
+
const { COLORS, FONT_SIZE, DARK_MODE } = theme;
|
|
24
24
|
|
|
25
25
|
const showModal = () => {
|
|
26
26
|
setModalVisible(true);
|
|
@@ -30,7 +30,7 @@ export const PDFReader = ({ card, share }) => {
|
|
|
30
30
|
setModalVisible(false);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const styles = pdfStyles(COLORS, FONT_SIZE);
|
|
33
|
+
const styles = pdfStyles(COLORS, FONT_SIZE, DARK_MODE);
|
|
34
34
|
|
|
35
35
|
const headerStyles = StyleSheet.flatten([
|
|
36
36
|
styles.header,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export const pdfStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
3
|
+
export const pdfStyles = (COLORS, FONT_SIZE, DARK_MODE) => StyleSheet.create({
|
|
4
4
|
container: {
|
|
5
5
|
flex: 1,
|
|
6
6
|
},
|
|
@@ -18,7 +18,8 @@ export const pdfStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
|
18
18
|
fontSize: FONT_SIZE.h2,
|
|
19
19
|
lineHeight: FONT_SIZE.h2 * 1.3,
|
|
20
20
|
marginLeft: 5,
|
|
21
|
-
color: COLORS.BRAND_1,
|
|
21
|
+
color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_1,
|
|
22
|
+
fontStyle: 'italic',
|
|
22
23
|
},
|
|
23
24
|
pdfButton: {
|
|
24
25
|
flexDirection: 'row',
|
|
@@ -26,7 +27,7 @@ export const pdfStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
|
26
27
|
alignItems: 'center',
|
|
27
28
|
},
|
|
28
29
|
fileIcon: {
|
|
29
|
-
color: COLORS.BRAND_1,
|
|
30
|
+
color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_1,
|
|
30
31
|
},
|
|
31
32
|
pdfStyle: {
|
|
32
33
|
flex: 1,
|
|
@@ -28,7 +28,10 @@ export const PrimaryStoryCard = (props) => {
|
|
|
28
28
|
const DATE_FORMAT = I18nManager.isRTL ? 'yyyy , MMM d' : 'd MMM, yyyy';
|
|
29
29
|
|
|
30
30
|
const styles = storyStyles(COLORS, FONT_SIZE);
|
|
31
|
-
|
|
31
|
+
const containerStyle = StyleSheet.flatten([
|
|
32
|
+
styles.container,
|
|
33
|
+
{ paddingHorizontal: props.horizontalPadding },
|
|
34
|
+
]);
|
|
32
35
|
const headlineStyle = StyleSheet.flatten([
|
|
33
36
|
styles.headline,
|
|
34
37
|
props.headlineStyle,
|
|
@@ -49,13 +52,13 @@ export const PrimaryStoryCard = (props) => {
|
|
|
49
52
|
testID={COMP_GENERAL_CONSTANTS.primaryStoryCard}
|
|
50
53
|
onPress={throttledOnpress}
|
|
51
54
|
activeOpacity={0.8}
|
|
55
|
+
style={containerStyle}
|
|
52
56
|
>
|
|
53
57
|
<ResponsiveImage
|
|
54
58
|
metaData={getImageMetadata(story)}
|
|
55
59
|
slug={getImageSlug(story)}
|
|
56
60
|
cdn={props.cdn}
|
|
57
61
|
imageWidth={props.imageWidth}
|
|
58
|
-
hero
|
|
59
62
|
>
|
|
60
63
|
<Text style={styles.xminContainer}>
|
|
61
64
|
{' '}
|
|
@@ -101,8 +104,10 @@ PrimaryStoryCard.propTypes = {
|
|
|
101
104
|
authorTextStyle: PropTypes.func,
|
|
102
105
|
story: PropTypes.object.isRequired,
|
|
103
106
|
onPress: PropTypes.func,
|
|
107
|
+
horizontalPadding: PropTypes.number,
|
|
104
108
|
};
|
|
105
109
|
|
|
106
110
|
PrimaryStoryCard.defaultProps = {
|
|
107
111
|
cdn: '',
|
|
112
|
+
horizontalPadding: 12,
|
|
108
113
|
};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import PropTypes from
|
|
2
|
-
import React, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, {
|
|
3
|
+
memo, useCallback, useContext, useState,
|
|
4
|
+
} from 'react';
|
|
5
|
+
import { StyleSheet, View } from 'react-native';
|
|
6
|
+
import FastImage from 'react-native-fast-image';
|
|
7
|
+
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
8
|
+
import { isTablet } from 'react-native-device-info';
|
|
9
|
+
import { FallbackIcon } from '../../Icons/FallBackIcon';
|
|
10
|
+
import { AppTheme } from '../../utils';
|
|
11
|
+
import { getImageURL } from '../../utils/imageUtils';
|
|
10
12
|
|
|
11
13
|
const ResponsiveImageBase = (props) => {
|
|
12
14
|
const [placeholder, setPlaceholder] = useState(true);
|
|
13
15
|
const { theme } = useContext(AppTheme);
|
|
14
16
|
const { COLORS, CustomFallBackIcon, CustomFallBackBackground } = theme;
|
|
15
17
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
+
const HERO_IMAGE_HEIGHT = isTablet() ? 300 : 232;
|
|
19
|
+
|
|
18
20
|
const flattenedImageStyle = StyleSheet.flatten([
|
|
19
21
|
styles.defaultImage,
|
|
20
22
|
props.styles,
|
|
@@ -23,17 +25,17 @@ const ResponsiveImageBase = (props) => {
|
|
|
23
25
|
height: (props.imageWidth * 9) / 16,
|
|
24
26
|
},
|
|
25
27
|
props.hero && {
|
|
26
|
-
width:
|
|
28
|
+
width: '100%',
|
|
27
29
|
height: HERO_IMAGE_HEIGHT,
|
|
28
|
-
alignSelf:
|
|
30
|
+
alignSelf: 'stretch',
|
|
29
31
|
},
|
|
30
32
|
]);
|
|
31
33
|
|
|
32
34
|
const placeholderStyle = {
|
|
33
35
|
...StyleSheet.absoluteFillObject,
|
|
34
36
|
backgroundColor: CustomFallBackBackground || COLORS.MONO6,
|
|
35
|
-
justifyContent:
|
|
36
|
-
alignItems:
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
alignItems: 'center',
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const fallBackIcon = CustomFallBackIcon ? (
|
|
@@ -47,7 +49,7 @@ const ResponsiveImageBase = (props) => {
|
|
|
47
49
|
|
|
48
50
|
const showFallBackIcon = () => {
|
|
49
51
|
switch (props.type) {
|
|
50
|
-
case
|
|
52
|
+
case 'author':
|
|
51
53
|
return userFallback();
|
|
52
54
|
default:
|
|
53
55
|
return fallBackIcon;
|
|
@@ -32,6 +32,10 @@ export const SecondaryStoryCard = (props) => {
|
|
|
32
32
|
|
|
33
33
|
const DATE_FORMAT = I18nManager.isRTL ? 'yyyy ,MMM d' : 'd MMM, yyyy';
|
|
34
34
|
|
|
35
|
+
const containerStyle = StyleSheet.flatten([
|
|
36
|
+
styles.container,
|
|
37
|
+
{ paddingHorizontal: props.horizontalPadding },
|
|
38
|
+
]);
|
|
35
39
|
const headlineStyle = StyleSheet.flatten([
|
|
36
40
|
styles.headline,
|
|
37
41
|
props.headlineStyle,
|
|
@@ -55,7 +59,7 @@ export const SecondaryStoryCard = (props) => {
|
|
|
55
59
|
testID={COMP_GENERAL_CONSTANTS.secondaryStoryCard}
|
|
56
60
|
onPress={throttledOnpress}
|
|
57
61
|
activeOpacity={0.8}
|
|
58
|
-
style={
|
|
62
|
+
style={containerStyle}
|
|
59
63
|
>
|
|
60
64
|
<ResponsiveImage
|
|
61
65
|
metaData={getImageMetadata(story)}
|
|
@@ -112,4 +116,10 @@ SecondaryStoryCard.propTypes = TouchableOpacityProps && {
|
|
|
112
116
|
dateTextStyle: TextStyle,
|
|
113
117
|
story: PropTypes.any.isRequired,
|
|
114
118
|
iconComponent: PropTypes.element,
|
|
119
|
+
horizontalPadding: PropTypes.number,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
SecondaryStoryCard.defaultProps = {
|
|
123
|
+
cdn: '',
|
|
124
|
+
horizontalPadding: 12,
|
|
115
125
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export const secStoryCardStyles = ({ COLORS, FONT_SIZE, DARK_MODE }) => StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
backgroundColor: COLORS.BRAND_WHITE,
|
|
7
|
+
paddingVertical: 15,
|
|
8
|
+
},
|
|
4
9
|
headlineAndAuthorBlockContainer: {
|
|
5
10
|
flexShrink: 1,
|
|
6
11
|
flex: 1,
|
|
@@ -22,10 +27,6 @@ export const secStoryCardStyles = ({ COLORS, FONT_SIZE, DARK_MODE }) => StyleShe
|
|
|
22
27
|
alignItems: 'center',
|
|
23
28
|
flexDirection: 'row',
|
|
24
29
|
},
|
|
25
|
-
blockContainer: {
|
|
26
|
-
flexDirection: 'row',
|
|
27
|
-
paddingVertical: 15,
|
|
28
|
-
},
|
|
29
30
|
headline: {
|
|
30
31
|
color: COLORS.BRAND_BLACK,
|
|
31
32
|
opacity: 0.9,
|